一句话SQL语句

1)SELECT * from neu_prsc_manage.z_med_stock WHERE aae005 = 1029086;  查找

2)更新:UPDATE neu_prsc_manage.z_med_stock SET stock_num = "475" WHERE aae005=1029086;

3)select查询多个属性:SELECT id,pharmacy_name,stock_num FROM  neu_prsc_manage.z_med_stock WHERE aae005 = "1002737";

4)查询表有多少行: select count(*) from operation_log;

5)#查找医院编号相同且科室编号相同的   查找筛选多列重复的记录

SELECT hos_id,COUNT(hos_id), depart_num, COUNT(depart_num)
FROM department GROUP BY hos_id, depart_num
HAVING (COUNT(hos_id) > 1) AND (COUNT(depart_num) > 1) ;

 

 

 

 

 

SQL报错问题汇集:

 Truncated incorrect DOUBLE value   :  出现了筛选的数据中有重复的行造成无法更改:例如::UPDATE neu_prsc_manage.z_med_stock SET stock_num = "475" WHERE aae005=1029086 中 aae005=1029086 说明1029086有1029086和**1029086**,那么他选中就有2行,无法对某一行进行更改。

 

posted @ 2020-03-16 21:29  TonyHuang123  阅读(320)  评论(0编辑  收藏  举报