select * from (select xm,je from table) a , (select xm01,je01 from table) bwhere a.xm = b.xm01and a. ...
首先描述问题,student表中有字段startID,endID。garde表中的ID需要对应student表中的startID或者student表中的endID才能查出grade表中的name字段,这时候问题就来了,如果需要一条sql一句同时查出garde表中的两条数据怎么办 两表的关联字段为 SID sql select b.name,c.name as name from student ...
2015-06-14 21:24 2 4527 推荐指数:
select * from (select xm,je from table) a , (select xm01,je01 from table) bwhere a.xm = b.xm01and a. ...
ORDER BY 后可加2个字段,用英文逗号隔开。 f1用升序, f2降序,sql该这样写 ORDER BY f1, f2 DESC 也可以这样写,更清楚: ORDER BY f1 ASC, f2 DESC 如果都用降序,必须用两个desc ORDER BY f1 DESC ...
今天分享一个如何把name和model的值一起显示 name的值是(棉线,网布,蕾丝等) model的值是(A21-4321,12343,B123a等) 1 select concat( ...
今天遇到一个数据表的两个列数据要互换,在网上找到并记录下。 直接用Sql就可以搞定,语法如下 我们来模拟验证一下,在数据库建立一个这样的表 第一步:创建数据表 第二步:插入数据 第三步:查询数据(未执行前结果) 第四步:使用 ...
https://zhidao.baidu.com/question/243124782.html 展开全部 select * from A inn ...
之前使用MySQL、MSSQL的时候经常会遇到这种情况:查询同一表中某两个字段相等的数据,也就是说业务中有这种需求。这不我们又遇到了,但是此时我们使用的是mongodb。在mongodb中不像MySQL、MSSQL中那么简单,据说可以使用$where实现,但是我不太喜欢这种方式,并且我们的存储 ...