I tried using AND
for the same column in WHERE
clause, but it is not giving me any output. But there are two Customer names in the data set which satisfies the given condition. Where have I gone wrong?
SELECT CONCAT(c.CustFirstName," ",c.CustLastName) AS CustomerName
FROM Musical_Preferences mp
JOIN Customers c ON c.CustomerID = mp.CustomerID
WHERE mp.StyleID = 15 AND mp.StyleID = 24;
This above query worked fine when I put OR
for same column in WHERE
clause, but why not for AND
?
My data:
CustomerID CustFirstName CustLastName CustStreetAddress CustCity CustState CustZipCode CustPhoneNumber CustomerID StyleID PreferenceSeq 10001 Doris Hartwig 4726 - 11th Ave. N.E. Seattle WA 98105 555-2671 10001 10 2 10001 Doris Hartwig 4726 - 11th Ave. N.E. Seattle WA 98105 555-2671 10001 22 1