-1
我有一个数据库表。mySql如何按列值排序选定结果
在这个表中我有列名User_Id。
我想3级命令的结果:
- 最初的结果应该是特定的用户ID 2 + 3。按一些列排序。
是有可能使一些像这样的查询:
Select * From User
Order By User_Id = 1223, Start_Date, Last_Name;
UPDATE:
这是我的查询:
SELECT Events.Event_Id, Events.Name as Event_Name, Events.Place, Events.Start_Time, Events.End_Time, getEventInvitedUsers(Events.Event_Id) as Invited_Users, getEventAttendingUsers(Events.Event_Id) as Attending_Users,
Users.Facebook_Id, Users.Name as User_Name, Users_In_Events.Is_Attending as Is_Attending
FROM Users_In_Events
Left Join Events
On Users_In_Events.Event_Id = Events.Event_Id
Left Join Users
On Events.Facebook_Id = Users.Facebook_Id
WHERE
Users_In_Events.Facebook_Id = 613714903
And
(Events.Start_Time > now()
Or
(Events.Start_Time > now() And Events.End_Time < now()))
Order By Events.Facebook_Id= 613714903, Users_In_Events.Is_Attending, Events.Start_Time;
查询返回的所有排序来自事件表的事件。
我想知道,如果它是可能的,我写在上面的代码Events.Facebook_Id= 613714903
你能重新表达一下你的问题吗? – HichemSeeSharp
有一种方法,但你的SQL不是它。显示示例输出并解释如何对它进行排序。 – AgRizzo
是的......这是可能的,但你不能使用=操作符的原因顺序..所以试试这个选择*从用户 其中User_Id = 1223 Order By User_Id,Start_Date,Last_Name; –