So not too sure how to go about this, but ideally I want to pull out matching & non-matching info from an array of rows in a table, so I have a table with info like this:

12,2019-07-15 06:02:52,sw72,56,19,DISC,5038-fc:cf:62:88:e9:00 12,2019-07-15 06:02:52,sw72,56,20,DISC,5038-fc:cf:62:88:e9:00 12,2019-07-15 06:02:52,sw72,71,19,DISC,5047-fc:cf:62:88:e9:00 12,2019-07-15 06:02:52,sw72,71,20,DISC,5047-fc:cf:62:88:e9:00 12,2019-07-15 06:02:52,sw72,83,19,DISC,5053-fc:cf:62:88:e9:00 12,2019-07-15 06:02:52,sw72,83,20,DISC,5053-fc:cf:62:88:e9:00 12,2019-07-15 06:02:52,sw74,1,44,DISC,7001-00:25:03:b7:cc:00

13,2019-07-16 06:02:46,sw71,111,23,DISC,706f-00:25:03:b7:cc:00 13,2019-07-16 06:02:46,sw71,111,24,DISC,706f-00:25:03:b7:cc:00 13,2019-07-16 06:02:47,sw72,112,19,DISC,5070-fc:cf:62:88:e9:00 13,2019-07-16 06:02:47,sw72,60,19,DISC,503c-fc:cf:62:88:e9:00 13,2019-07-16 06:02:47,sw72,83,19,DISC,5053-fc:cf:62:88:e9:00 13,2019-07-16 06:02:47,sw72,83,20,DISC,5053-fc:cf:62:88:e9:00 13,2019-07-16 06:02:47,sw74,1,44,DISC,7001-00:25:03:b7:cc:00

What I want to do is pull out the differences based on column 1 (so select * from table where column1 = 12 or 13) then pull out the differences but ignoring the datetime in column2.. So column 3,4,5 needs checking..

i.e. rows 1 & 2 in the top set of data, do not match the 2nd set of data (but all in the same SQL table)..

then I want to also pull out the differences too.. so in the 2nd set of data I want to return the lines that don't match (in a separate query)

So I guess my question is, can i use different queries to pull out the mismatched info from either set of data, then the matching data?

perhaps i need 3 separate queries, but not too sure where to start on this one as I'm not a SQL DBA, just a basic SQL admin.

Many thanks in advance for any assistance!

  • What RDBMS is this for? I assume SQL Server, but it's not explicitly stated. – John Eisbrener Jul 19 at 15:42
  • Apologies, yes, SQL. (well SQL express). – Alex Jul 20 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.