新增:新增字段和查询字段个数相同。
INSERT INTO coal_prices_trend (id,a_fare,two_tickets,create_time,goods_type,type)
(SELECT id,excluding_tax_price 一票,including_tax_price,created_time,coal_type 类型,3 FROM fields_price
)
修改:修改字段和查询字段个数相同。
update coal_prices_trend (id,a_fare,two_tickets,create_time,goods_type,type)
(SELECT id,excluding_tax_price 一票,including_tax_price,created_time,coal_type 类型,3 FROM fields_price
)
where id=‘’
多个表进行查询显示多个表的数据思路:
SELECT address,num,visvit_num FROM (
SELECT count(*) num,SUBSTRING_INDEX(end_point,‘,’,1) address from driver_route GROUP BY SUBSTRING_INDEX(end_point,‘,’,1) ORDER BY num desc LIMIT 10
) d LEFT JOIN (
SELECT count(*) visvit_num,SUBSTRING_INDEX(d.end_point,‘,’,1) address1 FROM driver_route d
LEFT JOIN driver_user_account da
on d.user_id = da.id
where da.contact_user is not null
GROUP BY SUBSTRING_INDEX(d.end_point,‘,’,1)
) d1 on d.address = d1.address1