SELECT
c.LastName,
c.FirstName,
i.InvoiceId,
i.CustomerId,
i.InvoiceDate,
i.BillingCity,
i.total
FROM
invoices i
INNER JOIN
customers c ON i.CustomerId = c.CustomerId
WHERE
BillingCity LIKE 'P%'
OR Billingcity NOT LIKE 'D%'
I want to know what is the purpose of AND operator and How do I use AND in the query above to find customers from New York who have spent 10$ ?
CodePudding user response:
Use this:
SELECT
c.LastName,
c.FirstName,
i.InvoiceId,
i.CustomerId,
i.InvoiceDate,
i.BillingCity,
i.total
FROM
invoices i
INNER JOIN
customers c ON i.CustomerId = c.CustomerId
WHERE
i.BillingCity = 'New York' AND i.total = 10