MySQL returns more than one row with AND operator match

by Abu Nooh   Last Updated October 18, 2019 23:06 PM

I have two tables 1:n relationship, customer to orders the schema is in the!9/a6842e/1 I have created.

The key in customer is composite id and type. I am trying to get the email address from the customer table where the order_id is = 2

So the query is:

SELECT email FROM customer c, orders o WHERE o.custId = AND = 2

This is returning two rows even though I specified = 2

Here's a fiddle

How to get just the email where = 2 and that rows foreign key = primary key of customer table.

Any help appreciated.

Tags : join mysql-5.6

Related Questions

Updated June 22, 2016 08:02 AM

Updated August 02, 2018 17:06 PM

Updated March 06, 2016 01:02 AM

Updated August 02, 2018 13:06 PM