I have two tables.
User with columns UserId, Area
The Area
column is populated with multiple comma separated values (from listbox) - data looks like this:
User1 KA,TN,AP,GJ
User2 MH,UP,MP,GJ
Order with columns OrderID, ProductID, Qty, Area
Data looks like this:
1 Prod1 10 GJ
2 Prod1 22 MH
3 Prod2 3 AP
4 Prod2 77 TN
How to select rows from Order
table based on User
table?
Say logged in user is User1
. His areas are KA,TN,AP,GJ
.
The result should look like this:
Prod1 10 GJ
Prod2 77 TN
Please advise on the SQL query to get this result.
Thanks and regards Krishna