数据库基础操作

  1. 显示查询结果使用排序功能
    order by [列名] desc; #desc 表示降序,asc 表示升序
    例:select * from 表名 where ID = '001' order by createtime desc;
    createtime(创建时间) ,默认显示时间为升序,使用order by [列名] desc 转为降序显示

  2. 把多条查询语句结果显示在一个窗口:union all
    ---例:把下面3条结果显示在同一窗口------
    select from 表名 where ID = '001' union all
    select
    from 表名 where ID = '002' union all
    select * from 表名 where ID = '003'

猜你喜欢

转载自blog.51cto.com/hqq0000/2323932