现在的位置: 首页 > 综合 > 正文

mysql精简语句集

2012年09月13日 ⁄ 综合 ⁄ 共 190字 ⁄ 字号 评论关闭

1、  在查询出的结果前面加上编号/序号,用自定义变量实现

select @i:=@i+1 from `order` where `id`<200;

2、  用户自定义变量

set @i=0;

Query OK, 0 rows affected (0.01 sec)

3、  将数据表字段命名为别名

select `foodname` as "美食名称",`foodprice` from `order` where `id`<100;

抱歉!评论已关闭.