找回密码
 立即注册
查看: 1204|回复: 0

记录几个sql语句

[复制链接]

6782

主题

8

回帖

2万

积分

管理员

积分
21777
发表于 2019-5-20 15:43:46 | 显示全部楼层 |阅读模式
1、插入带时间与null值的

insert into product values(null,'','20422REV','','','','','','','','','','','','',getdate(),getdate(),'','hl-qc','','')





2、插入不重复的数据的

insert into product select other1,other2,other3,other4,other5,other6,other7 from product_temp where not exists(select * from product where other1=product_temp.other1 or other2=product_temp.other2)



insert into product select item,ref,other_item,rose_item,rose_len,leaf_item,leaf_len,base_item,base_len,others1,others2,others3,others4,item_check,qc_check,pic_date,add_date,adder,pic,pichave,item_sort from product2 where not exists(select * from product where item=product2.item or other_item=product2.other_item)



3、查询重复的数据的

select * from product_temp where not exists(select * from product where other1=product_temp.other1 or other2=product_temp.other2)



4、复制表结构的

select * into product1 from product where 1=2
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表