The title might be a little hard to comprehend because I'm bad at summarizing things, but what I'm trying to do is actually very simple (in any other language).
I want to test some data in a Sybase table, specifically two columns. These two columns have colon separated strings - and unfortunately, the position of each substring is not the same between both columns. It's something like this:
column_1
substring1:substring3:substring5
substring2:substring4:substring6
column_2
substring3:substring1:substring5
substring6:substring2:substring4
What I want to do is provide a simple pass/fail status if substrings of column1 do not equal the substrings of column2. I don't care about the order of the substrings and can't change the order of them before they get to the table. I just want to be able to say:
The test passes if column1 has the same content as column2 regardless of order, and if column1 or column2 contain information that is not present in the other, then it fails.
I could do this blindfolded in something like Python, but I'm not very proficient in SQL. Here's roughly how I'm querying the table:
select columna, columnb, columnc, columnd, column_1, column_2, CASE <do tests here> END as test_results from table
Any thoughts? I want to keep it a simple as possible ideally!
Aucun commentaire:
Enregistrer un commentaire