Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

sql select query and virtual field

$
0
0

Dear all,
I have a table with following field and I am trying to find a way to run a query that will have a virtual field with the data. I have no idea how to do this, I will be very grateful if someone can help me please.

Name-Group
John-1
Rose-2
Mary-2
Jane-3
Pat-1
Sid-3
Bob-4
Charlie-4
Harry-1

I have a query

SQL
Select*fromtablestaff

I would like the Select query to create a virtual field called "Status" that will list Junior if the Group is 1 or 2 or Senior if it is 3 or 4

Result should be like this:

Name-Group-Status
John-1-Junior
Rose-2-Junior
Mary-2 -Junior
Jane-3 -Senior
Pat-1 -Junior
Sid-3 -Senior
Bob-4 -Senior
Charlie-4-Senior
Harry-1 -Junior

Any help would be much appreciated, thank you


Viewing all articles
Browse latest Browse all 4871


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>