SQL字段排序

[复制链接]
查看11 | 回复3 | 2009-7-23 09:25:46 | 显示全部楼层 |阅读模式
select * from [table] where pid=5union allselect * from [table] where pid 5 order by pic如果你的表名字叫table的话就要加上[],因为table是关键字。是不是应该order by pid呢?select * from [table] where pid=5union allselect * from [table] where pid 5 order by pid
回复

使用道具 举报

千问 | 2009-7-23 09:25:46 | 显示全部楼层
select * ,case pid when 5 then 1 else 2 end as b from @torder by b, pid asc写个差不多的。
回复

使用道具 举报

千问 | 2009-7-23 09:25:46 | 显示全部楼层
select * from table where pid=5union all select * from table where pid5 order by pid
回复

使用道具 举报

千问 | 2009-7-23 09:25:46 | 显示全部楼层
SELECT * FROM TABLE WHERE PID=5UNIONSELECT * FROM TABLE WHERE PID5 ORDER BY PIDGO一定可以,不要把问题复杂化!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行