0

i have table named departments has column named tax_code nvarchar2 datatype saved value 01,33,E1

when i want to use this value in this code

select id,name from employee 
where taxcode in( select tax_code from department)

give me the value

where taxcode in('01,33,E1') this wrong

i want this

where taxcode in('01','33','E1') 

regards

above in details i explain

PM 77-1
  • 12,933
  • 21
  • 68
  • 111
  • 2
    Just don't store comma-separated strings when you are interested in the separate values. This violates database normalization (first normal form). Make this a proper table with one value per row and your query will run just fine. – Thorsten Kettner Jan 07 '23 at 19:22
  • ... or https://stackoverflow.com/questions/4672545/using-the-in-clause-with-a-comma-delimited-string-from-the-output-of-a-replace – PM 77-1 Jan 07 '23 at 19:27
  • Since it was closed a second before I was able to answer and I don't want my work to go to waste: you can try the following query: https://dbfiddle.uk/nu4YaNLb . As mentioned above, you should address how your data is being entered into the database because it violates 1NF - its best to fix it at the root. – griv Jan 07 '23 at 20:04

0 Answers0