Reputation: 49
Okay I have been putting this off because it has been partially working, now I need it.
I want this output:
id position
1 1
2 2
15 3
16 4
I thought this^ would do it. But I am getting the whole pages table.
SELECT *
FROM pages
ORDER BY position ASC
id link_id menu_name position content visible
1 1 New Article 1 This is the first Picture and Article 1
2 1 Edit Articles 2 Delete Articles/Edit 333
Upvotes: 0
Views: 3168
Reputation: 6950
whenever you need specific columns from the table ...you need to mention them in your SELECT clause.
In your case you need id and position only so your query will be
SELECT id, position FROM pages ORDER BY position ASC
For further learning check this link..
hope this helps you..
Upvotes: 0
Reputation: 1331
The * in your query means you'll select every colomn, just use the columnames you want to retrieve.
example:
SELECT id, position FROM pages ORDER BY position
That's all ;)
Upvotes: 1
Reputation: 19563
All you need to do is specify your columns:
SELECT id, position FROM pages ORDER BY position ASC
Upvotes: 1