Avatar of Erika Koelle
Erika Koelle
Flag for United States of America

asked on 

SQL Search Query String

I have a project that just had the parameters changed.  It used to be that an employee logs in and see's the work that's assigned to them only.  Now the employee is supposed to sign in and see their job assignments first and then other job assignments.  In the old days the command was select * from table where employee = 'john'

Results:
Name:   Job Stop:
John      123 Main St
John      876 Oak Ave
John      345 Maple Road

This was fine because the person in charge of operations just wanted names and the order of the database which was imported from an Excel spreadsheet to remain the same.  Now from a logic perspective, I'm not quite sure how to do a:
select * from table where [employee] = 'john' -- list these first in no order other than how originally in database and then list all the others
I guess I could be sloppy and have a 2nd select there such as:
select * from table where not [employee] = 'john'

Results:
Name:   Job Stop:
John      123 Main St
John      876 Oak Ave
John      345 Maple Road
Tom      643 Birch St
Tom      222 Rose Ave
Bob      909 Sky Drive
Josh      877 Park Ave

Thanks in advance...
DatabasesSQL

Avatar of undefined
Last Comment
Erika Koelle

8/22/2022 - Mon