Question:
I have the following:
sql="select * from products"
How do I sort or order by two columns retrieved in the “*”?
Answer:
You need to specify them directly in a clause following the one you have, as in:
select * from authorsorder by au_lname,au_fname
This will get you all the columns in authors sorted by last name, then first name.
Note that it is poor practice to use “select *
” because you could be opening a Pandora’s box of unexpected results. It is better practice to name the columns you expect in the result set or use the INFORMATION_SCHEMA views to find out what you need.