1

im trying to select * from table1 where forename, surname = 'Joe Bloggs'

obviously forename and surname are 2 different columns in table one but im getting errors when i run this SQL code:

SELECT * from table1 where forename, surname = 'Joe Bloggs'

Any ideas on what i can do?

1 Answer 1

5

maybe you mean

SELECT * from table1 where CONCAT_WS(' ',forename, surname) = 'Joe Bloggs'

OR

SELECT * from table1 where 'Joe Bloggs' IN (forename, surname)

OR

SELECT * from table1 where forename = 'Joe' AND surname = 'Bloggs'
Sign up to request clarification or add additional context in comments.

2 Comments

i used the first one using CONCAT
@charliejsford next time when you ask a question, be sure to state the problem clearly and the things you need :)

Your Answer

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