有一个需求表(demand),每一记录就是一条需求:另外有一个报价表(quotation),每一条记录是对需求记录的报价详情. 需求表: 报价表: 我现在想得到每条需求的信息以及有多少人报价了,我们可以使用 SELECT v9_demand.*, ( SELECT count(q.id) FROM v9_quotation q where q.dem_id = v9_demand.id ) AS qnum FROM v9_demand ORDER BY id ASC; 呵呵,每天记录一点点,加油…
) AS t1 LEFT JOIN (SELECT * FROM dbo.xcqy2017_News_Classification) AS t2 ON t2.Ncid = t1.Ncid left join左链接 以左表为主表 ) AS t1 RIGHT JOIN (SELECT * FROM dbo.xcqy2017_News_Classification) AS t2 ON t2.Ncid = t1.Ncid right join右链接 以右表为主表 SELECT CASE THEN '新闻…
字段合并: select EVFOUNDATIONTYPEA || EVFOUNDATIONTYPEB|| EVFOUNDATIONTYPEC ||EVFOUNDATIONTYPED as b from T_FOUNDATION_SETTING t 合并字段内容并统计: select a,Count(a)from ( select EVFOUNDATIONTYPEA as a from T_FOUNDATION_SETTING union all select EVFOUNDATIONTYPEB…