• mysql插入


    INSERT INTO tbl_location_data_real(card_id,
    id,
    lon,
    lat,
    speed,
    source,
    data_time,
    is_delete,
    `out`,
    out_volumes,
    `in`,
    in_volumes,
    in_loading,
    out_unloading,
    volume_datum,
    course,
    heading,
    depth_avg,
    water_depth_info,
    shipSandFence,
    sandFenceType
    )
    SELECT card_id,
    id,
    lon,
    lat,
    speed,
    source,
    data_time,
    is_delete,
    `out`,
    out_volumes,
    `in`,
    in_volumes,
    in_loading,
    out_unloading,
    volume_datum,
    course,
    heading,
    depth_avg,
    water_depth_info, getShipSandFence(lon,lat,card_id),getShipSandFenceInOrOut(lon,lat,card_id) 
     from tbl_location_data_2022_11 WHERE data_time in(
    SELECT max(data_time) from tbl_location_data_2022_11 WHERE card_id in ('08a010d1-5e7b-11ed-a216-00163e146705',
    '08a4db83-5e7b-11ed-a216-00163e146705',
    '08a96fba-5e7b-11ed-a216-00163e146705',
    '08ade4ea-5e7b-11ed-a216-00163e146705',
    '08b23db3-5e7b-11ed-a216-00163e146705',
    '08b6ee27-5e7b-11ed-a216-00163e146705',
    '08bbbdfd-5e7b-11ed-a216-00163e146705',
    '08c03329-5e7b-11ed-a216-00163e146705',
    '08c4a742-5e7b-11ed-a216-00163e146705',
    '08c935b0-5e7b-11ed-a216-00163e146705',
    '08cdd5a9-5e7b-11ed-a216-00163e146705') group by card_id) and card_id in ('08a010d1-5e7b-11ed-a216-00163e146705',
    '08a4db83-5e7b-11ed-a216-00163e146705',
    '08a96fba-5e7b-11ed-a216-00163e146705',
    '08ade4ea-5e7b-11ed-a216-00163e146705',
    '08b23db3-5e7b-11ed-a216-00163e146705',
    '08b6ee27-5e7b-11ed-a216-00163e146705',
    '08bbbdfd-5e7b-11ed-a216-00163e146705',
    '08c03329-5e7b-11ed-a216-00163e146705',
    '08c4a742-5e7b-11ed-a216-00163e146705',
    '08c935b0-5e7b-11ed-a216-00163e146705',
    '08cdd5a9-5e7b-11ed-a216-00163e146705')
    ON DUPLICATE KEY UPDATE
    card_id = VALUES(card_id),
    id= VALUES(id),
    lon= VALUES(lon),
    lat= VALUES(lat),
    speed= VALUES(speed),
    source= VALUES(source),
    data_time= VALUES(data_time),
    is_delete= VALUES(is_delete),
    out_volumes= VALUES(out_volumes),
    `out`= VALUES(`out`),
    `in`= VALUES(`in`),
    in_volumes= VALUES(in_volumes),
    in_loading= VALUES(in_loading),
    out_unloading= VALUES(out_unloading),
    volume_datum= VALUES(volume_datum),
    course= VALUES(course),
    heading= VALUES(heading),
    depth_avg= VALUES(depth_avg),
    water_depth_info= VALUES(water_depth_info),
    shipSandFence=getShipSandFence(values(lon),values(lat),values(card_id)),
    sandFenceType=getShipSandFenceInOrOut(values(lon),values(lat),values(card_id)) 
    ;

    create EVENT oneMinutesLocationReal
    ON SCHEDULE EVERY 1 MINUTE STARTS '2022-01-01 00:00:00' 
    ON COMPLETION NOT PRESERVE ENABLE
    DO 
    BEGIN
     call insert_location_real(); 
    END 

  • 相关阅读:
    Shell 基本运算符
    【配置多个ssh keys】在同一台电脑上,同时配置多个ssh keys (私钥和公钥),以操作不同的Git托管平台仓库
    既然有 HTTP 协议,为什么还要有 RPC
    clickhouse的安装和配置
    【Java后台】从零开始的Java后台开发(三)
    ZCU102 Zynq MPSoC IP设置与说明
    react09 hooks(useState)
    9.2CubeMx配置SD卡FATFS系统_stm32H7系列 SD卡 FR_NO_FILESYSTEM 找不到FatFs系统的问题
    【11.2】【VP】Codeforces Round #727 (Div. 2)
    攻防世界题目练习——Web引导模式(三)(持续更新)
  • 原文地址:https://blog.csdn.net/jsboy123/article/details/127869141