Reputation: 12512
If I have a table with data in the following format:
id itemID projectID position_X position_Y
________________________________________________
1 2677 10 -289 -27
2 2653 10 -403 253
3 337 10 -23 -77
4 2456 10 50 130
and I need to create 3 different queries to output results as a list where:
How would I do that?
Upvotes: 0
Views: 60
Reputation: 339
Alright, given the comments on the OP, I would say your 3 queries would be something like:
SELECT position_X, position_Y FROM <tablename> ORDER BY position_X DESC, position_Y DESC;
SELECT position_X, position_Y FROM <tablename> ORDER BY position_Y DESC, position_X DESC;
SELECT positon_X, position_Y FROM <tablename> ORDER BY <desiredcolumn> DESC;
(Keeping in mind I don't know the table name, or the exact sort order of the third query)
Given the data you've posted, outputting these three queries in order would give you:
First Query:
50, 130
-23, -77
-289, -27
-403, 253
Second Query:
-403, 253
50, 130
-289, -27
-23, -77
(Query three isn't certain due to not having a decision on what sort order)
Upvotes: 2