[SQL ] SQL语法上单引号、双引号问题

楼主: nature23306 (pART)   2017-05-13 11:46:06
想问关于SQL写法的问题
一直语法错误 orz
有三个表格A B C
每个表格都有id和item_index字段
想要搜寻符合条件的id、item_index资料
google后,使用UNION
因为有参杂 %s,所以一直过不了
query = sprintf("SELECT id FROM A WHERE item_index = %s", GetNumber(value)"
UNION
SELECT id FROM B WHERE item_index = %s", GetNumber(value)"
UNION
SELECT id FROM C WHERE item_index = %s", GetNumber(value)"");
请各位大大帮忙开示了
作者: criky (2501-2)   2017-05-13 15:30:00
要双引号吧ex:"%s"

Links booklink

Contact Us: admin [ a t ] ucptt.com