文档归类:数据库
实例:insert into onethink.ds_ucenter_member (group_id,username,`password`,email,reg_time) select 6 as group_id,d.username,d.`password`,d.email,d.regdate from dsui.pre_ucenter_members as d WHERE not exists (select * from onethink.ds_ucenter_member where onethink.ds_ucenter_member.username = d.username or onethink.ds_ucenter_member.email = d.email );mysql复制一个表的数据到另一个表,并且指定某个字段的值,两表数据结构可不同...
这文章不得了,一定要看完 »
在做项目的时候,需要同时去查询两张表的数据,但是两张表之间没有任务的关联,同时还要对查询的数据进行分页操作。例:表一:Team有字段:ID,NAME,URL,LITPIC,INFO,ADDTIME,IS_DEL...表二:INVES有字段:ID,TITLE,URL,LITPIC,INFO,ADDTIME,IS_DEL...两表之间没有关联,要项目查询的时候需要将两表INFO模糊查询,关展示出来。SELECT `NAME` AS TITLE,URL,LITPIC,INFO FROM Team where INFO LIKE '%教育%' LIMIT 10 UNION SELECT TITLE,URL,LITPIC,INFO FROM INVES WHERE INFO LIKE '%教育%' LIMIT 10;这样就可以解决问题。...
持之以恒,坚持读完»