I am facing a bit of problem in retrieving the records from my datatable. Can anybody please offer me any suggestions?
Id LearnerId ConnectionId IsApproved
3 1 38 1
5 39 1 1
7 1 31 1
13 1 30 1
31 1 40 1
34 41 1 1
35 31 1 1
39 1 42 1
This is what my table looks like. I want to use the select query on this table to select the records like the following:
AllId
38
39
31
30
40
41
31
42
How do I write the query in order to find the above record list? I want to collect all ID’s other than 1.
You can use a
UNION ALLbetween two queries. The first will return theconnectionidvalues and the second returns thelearneridvalues:See SQL Fiddle with Demo