Skip to content
Advertisement

sql getting information, but in wrong order

I have the following query in sql:

a1 = the name

I need the information in the table to output the names its queried in the order ive asked, so I need 40 to be first then 28 so on on.

The reason for this is my code reads the results and stores in an array that then is used to display on a form.

The table that the SQL query comes from has the information stored in num order, so 28 will be read first etc etc.

As I have said I need to get the information in the order I entered in the where clause.

I’m thinking something to do with nested Select statements although ive never tried nested selects.

Or, is there an easy way?

Any help would be great!

Many thanks in advance!


Update:

ok here is the solution thanks to you guys!

Many thanks for all the posts! I wish I could flag more answers than just one, oh well upvotes all around!

Advertisement

Answer

Add the following ORDER BY clause:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement