0

Have the following Tables

  ID   Name  
 ---- ------ 
   1   A     
   2   B     
   3   C     
   4   D     
   5   E     

  UserID   Name   ApprovedList  
 -------- ------ -------------- 
       1   Ace    1             
       2   Bob    1             
       3   Cal    2|4|5         
       4   Doug   2             
       5   Eric   3             

I would like to pass in the UserID of 3 for Cal and get the following table back

  ID   Approved  
 ---- ---------- 
   1   No        
   2   Yes       
   3   No        
   4   Yes       
   5   Yes    

(I apologize for the terrible Table display, I googled SO Tables about 30 different ways and not one usable resource).

Seth Duncan
  • 1,255
  • 2
  • 13
  • 31
  • you should normalize your data. Putting multiple values in a single column is bad database design. – Barmar Apr 03 '15 at 03:12
  • 1
    See the answers in the related question, just replace comma with `|` because that's what you're using as the separator. – Barmar Apr 03 '15 at 03:16
  • 1
    `Putting multiple values in a single column is bad database design.` True, but oftentimes one is stuck supporting a legacy application that has a bad database design. – David Faber Apr 03 '15 at 17:21
  • @Barmar I was able to take pieces of that answer to find what I needed, although it wasn't as cut and dry as that answer, but I do appreciate the link to the resource. Also as David pointed out this was a legacy design I had no control over. – Seth Duncan Apr 07 '15 at 21:41

0 Answers0