SQL 如何让where条件等于一个变量 5
sql="SELECTb.titleFROMphpcms_special_contentASaLEFTJOINphpcms_contentASbONa.contentid...
sql="SELECT b.title FROM phpcms_special_content AS a
LEFT JOIN phpcms_content AS b ON a.contentid = b.contentid
LEFT JOIN phpcms_special AS c ON a.specialid = c.specialid
WHERE b.catid="'.{$CATEGORY[$r[catid]][catid]}.'}
这个where条件应该怎样写 这样写不对 展开
LEFT JOIN phpcms_content AS b ON a.contentid = b.contentid
LEFT JOIN phpcms_special AS c ON a.specialid = c.specialid
WHERE b.catid="'.{$CATEGORY[$r[catid]][catid]}.'}
这个where条件应该怎样写 这样写不对 展开
展开全部
不太理解你的等于一个变量是什么概念,
sql="SELECT b.title FROM phpcms_special_content AS a
LEFT JOIN phpcms_content AS b ON a.contentid = b.contentid
LEFT JOIN phpcms_special AS c ON a.specialid = c.specialid
WHERE b.catid=?"
PreparedStatement pst = con.prepareStatement(sql);
pst.setString(1,变量);
pst.executeQuery();
sql="SELECT b.title FROM phpcms_special_content AS a
LEFT JOIN phpcms_content AS b ON a.contentid = b.contentid
LEFT JOIN phpcms_special AS c ON a.specialid = c.specialid
WHERE b.catid=?"
PreparedStatement pst = con.prepareStatement(sql);
pst.setString(1,变量);
pst.executeQuery();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |