mahle
mahle

Reputation: 231

How to check if field has some a concatenated string of other fields?

I need to make a mysql query that checks that the email field is a concatenated string of firstname zip code last name? Would something like this do it:

SELECT * FROM `orders` 
HAVING primary_email 
LIKE 'delivery_first_name . delivery_postal_code . delivery_last_name%'

Any help would be greatly appreciated.

Upvotes: 0

Views: 220

Answers (1)

ajreal
ajreal

Reputation: 47331

should be like this instead

select * from orders
where 
primary_email
like concat(delivery_first_name, delivery_postal_code, delivery_last_name, '%');

if there is a separator between the column , add in the separator in between these columns

Upvotes: 2

Related Questions