Home  >  Q&A  >  body text

c++ - MYSQL查询union语句为什么没调成功,帮忙看看

(select from phome_enewszt where ztid=4324)union(select from phome_ecms_article where checked=1 and ztid="%(select * from phome_enewszt where ztid=4324)%" order by id desc limit 120)

这条SQL语句,

先从phome_enewszt 表调出字段: "ztid" 假设值;

然后在phome_ecms_article 表里面的"ztid" 字段中,
找出与phome_enewszt 表字段: "ztid" 相同的数据!

我肯定有达到条件的数据,但却调不出来,空白的,什么也没有,请问是不是SQL命令有问题??
phome_enewszt 有ztid字段
phome_ecms_article 也有ztid字段

并且两个的数据是一样的!

因为phome_ecms_article的ztid数据本来就调用phome_enewszt的ztid字段

阿神阿神2713 days ago497

reply all(0)I'll reply

No reply
  • Cancelreply