A表里面的字段有id(主键) tenderid content shijian jine fenlei
B表里面的字段有tenderid(主键)以及其他的字段,
我现在需要查询A表里面相同的tenderid下的content shijian jine fenlei 这几个里面的内容,有A表里面的tenderid 要与B表里面的tenderid相等的限制。
不知道我这样表达清楚了么,A表如图
B表
调用 数据库
------解决方案--------------------------------------------------------
Select a.id,a.content,a.shijian,a.jine,a.fenlei,a.tenderid,b.tenderid,b.userid,b.classid From a,b Where a.tenderid = b.tenderid
或:
Select a.id,a.content,a.shijian,a.jine,a.fenlei,a.tenderid,b.tenderid,b.userid,b.classid From a Left Join b On a.tenderid = b.tenderid
------解决方案--------------------------------------------------------
SELECT b.tenderid,b.userid,b.classid,a.id,a.userid,a.content,a.jine,a.shijian
from a,b
where a.tenderid=b.tenderid
------解决方案--------------------------------------------------------
select b.tenderid ,content,shijian,jine,fenlei from
B b
LEFT JOIN
A a
ON b.tenderid=a.tenderid