返回首页 我的新博客

mysql精简语句集

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;

posted @ 2011-05-20 20:25  buffer的blogs  阅读(229)  评论(0编辑  收藏  举报