Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

I have data like this in SQL Table

Id | Services | Country
_________________________
1 | A,B | E,F
2 | A1,B1 | E1,F1

Desired Result

Id | Services | Country
_________________________
1 | A | E
1 | A | F
1 | B | E
1 | B | F
2 | A1 | E1
2 | A1 | F1
2 | B1 | E1
2 | B1 | F1


Thanks in advace
Posted

1 solution

First, don't store info like that unless you really, really have to - doing it properly with an extra table or two seems like more work, but it means you don;t have to deal with problems like this (and they get worse, believe me - this is just the start of the problems designs like this cause later, when it's too late to fix them...)

Havign said that, it's possible. Nasty, but possible: Converting comma separated data in a column to rows for selection[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900