0

Hi please can you help.

I'm trying to select the last 200 rows in my database, then compare 2 fields in each row, and return each whole row where there is only 1 instance. So, all rows that have more than 1 instance are not returned.

Is that possible in a MySQL statement or will I need to code this in PHP?

Thank you in advance

I've tried having 2 SELECT queries and creating an array of each query and comparing each element in the first array with all the elements in the second array. This hasn't worked yet (probably my poor coding skills), so I thought it may have a more elegant solution.

Thank you

1 Answer 1

0

If you want to compare 2 columns - try "case" construction.

Somethig like:

select
    case when col1 = col2 then true else false end as check_condition
from table

Then use check_condition meaning to return right strings

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.