比如:已知,一号仓库数量为10,并且二号仓库数量为30的数据,求符合条件的是哪一个名称? 得到的正确记录应为:ID 1 西瓜,ID 2 西瓜SQL code: SELECT id,名称,仓库 from 表A WHERE ( 仓库='一号' and 数量='10' ) or (仓库='二号' and 数量='30' )
这个不对,会多取出2条记录: 5 大米 二号 30, 6 苹果 一号 10。 SQL code: SELECT id,名称,仓库 from WHERE 仓库='二号' and 数量='30' and 名称 in (SELECT 名称 from 表A WHERE 仓库='一号' and 数量='10')
SQL code
Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighligh
是用别人写的类做的,还原时提示You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO admin(seq,passwd,type,n ......