开发者

Help needed in MySql Select Query

Suppose a table has a Column "user_id" which is of integer type.

How to select a list of all the user_id except the minimum user_id in MySql ???

The Except keyword is not working in MySql as in Ms Sql

actually my user_开发者_运维知识库id selection is already based on a where clause like select user_id from table where ref_id=54 and i want to get all the user_id except the min one.plz help


i think you are looking for a solution like this..

here i will get each row except the row which have iUserID as min value

SELECT * FROM tbluser
WHERE tbluser.iUserID NOT IN (SELECT MIN(iUserID) FROM tbluser)


SELECT user_id
FROM table
WHERE user_id <> ANY (
  SELECT MIN(user_id) FROM table
);


SELECT USER_ID FROM TABLE WHERE USER_ID > (SELECT USER_ID FROM TABLE ORDER DESC TOP 1)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜