标签:简化 rom desc ima mysq pre mic com 结果
表名称比较长时,可以通过别名简化
SELECT c.orderTime,c.shishou,c.totalPrice,c.cid=1164 FROM cash_order c WHERE c.cid=1164
FROM cash_order c 即设置表cash_order的别名为c
如果有多个条件,用AND 连接
SELECT c.orderTime,c.shishou,c.totalPrice,c.cid=1164 FROM cash_order c WHERE c.cid=1164 AND c.totalPrice<5 and c.totalPrice>=1
排序时,用ORDER BY,默认是升序(ASC),如果要倒序显示,加DESC
SELECT c.orderTime,c.shishou,c.totalPrice,c.cid=1164 FROM cash_order c WHERE c.cid=1164 AND c.totalPrice<5 and c.totalPrice>=1 ORDER BY c.totalPrice DESC
限制查询的数量,用关键字LIMIT
SELECT c.orderTime,c.shishou,c.totalPrice,c.cid=1164 FROM cash_order c WHERE c.cid=1164 AND c.totalPrice<5 and c.totalPrice>=1 ORDER BY c.totalPrice DESC LIMIT 10
查询结果如下:
标签:简化 rom desc ima mysq pre mic com 结果
原文地址:https://www.cnblogs.com/may18/p/12430103.html