曾经写过的一些查询
下面这段以为有作用,但实际上用其它方法更简单,没用上下面的这段。
sqlstr="select return_date from storage_table where storage_id= (select storage_id from washhouse_table where wash_id="&mainkey&" )"
又写了一个,但比较长,看上去也不是很精简,有没有朋友帮着看看能修改修改?
select DISTINCT [crock],[bound_no],[goods_no],[size],[quantity_1],[paperpattern],prod.jo from payroll,prod where prod.prod_no = ( select DISTINCT prod_no from payroll where crock='0528892') and crock='0528892
在QQ上的朋友帮我改过了一次,大家一起来看看它修改成这样的优劣。
select DISTINCT [crock],[bound_no],[goods_no],[size],[quantity_1],[paperpattern],prod.jo from payroll,prod where exists ( select 1 from payroll where crock='0528892') and crock='0528892'
呵呵,上面的错误了,不正确得不到想要的结果,最后有一个高手MM来了,看不下去了。给我支了一条。
select DISTINCT [A.crock],[A.bound_no],[A.goods_no],[A.size],[A.quantity_1],[A.paperpattern] ,B.JO
from payroll A,prod B
WHERE A.PROD_NO = B.PRO_NO AND A.crock='0528892'
YES,就是这个样子,精简了很多。