February 20, 2018 at 10:53 am
How can i compare and find the values from two tables having column below like this.
Table A
Column A Column B
1 1
2 1
3 1
4 1
Table B
Column A Column B
1 1,2,3,4,5,6,7
2 2,3,4,5
3 3,4,5,6,7
4 1,5,6,7
Compare column b in two tables and give me the results when i fined 1 from tableB.Column B. Is that possible?
February 20, 2018 at 10:56 am
Sorry mixed up the columns.Let me put it exactly what i am looking for.
Table A
Column A
1
2
3
Column B
1
1
1
Table B
Column A
1
2
3
Column B
1,2,3,4
2,3,4,5
1,7,6,4
February 20, 2018 at 11:31 am
Can you please provide the test data in a consumable format.
What is your comparison logic and expected output?
February 20, 2018 at 11:55 am
Table A
ID Active_ID
1 1
2 1
3 1
Table B
ID Active Values
1 1,2,3,4,5
2 2,3,4,5,6
3 1,6,7,8,6
SO i want to compare Active_ID with Active values and when it find Active_ID 1 value in Active Values it should return the row. So Active_ID is 1 in table A and Table be with ID 1 Active values 1,2,3,4,5 but it has matching value of 1 so it should return the row. Is it possible?
February 20, 2018 at 1:00 pm
Admingod - Tuesday, February 20, 2018 11:55 AMTable A
ID Active_ID
1 1
2 1
3 1Table B
ID Active Values
1 1,2,3,4,5
2 2,3,4,5,6
3 1,6,7,8,6SO i want to compare Active_ID with Active values and when it find Active_ID 1 value in Active Values it should return the row. So Active_ID is 1 in table A and Table be with ID 1 Active values 1,2,3,4,5 but it has matching value of 1 so it should return the row. Is it possible?
Yes. It can be done. But the hops that you have to jump through to do it are one of the reasons that it is advised to never store CSV values in a column.
Now, unless you provide consumable data, with valid data types, we can only guess at a solution, which may or may not work.
Follow the link in my signature on how to post your request.
February 20, 2018 at 6:44 pm
Admingod, see my similar question on Ask SSC: https://ask.sqlservercentral.com/questions/146178/how-to-use-like-when-multiple-patterns-need-matche.html
Des, would be interested in your input there too.
-------------------------------------------------------------------------------------------------------------------------------------
Please follow Best Practices For Posting On Forums to receive quicker and higher quality responses
February 21, 2018 at 12:31 pm
jonathan.crawford - Tuesday, February 20, 2018 6:44 PMAdmingod, see my similar question on Ask SSC: https://ask.sqlservercentral.com/questions/146178/how-to-use-like-when-multiple-patterns-need-matche.htmlDes, would be interested in your input there too.
Jonathan. I would approach this in the same way that Oleg described in his response.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply