nemja
nemja

Reputation: 499

Still getting output that I want to exclude through sql query

I want to exclude 'bQR' through the following code:

SELECT *
FROM buyers
LEFT JOIN event ON buyers.fk_tiEvenementID=event.idEvent
WHERE buyers.tiTransactiedatum >='2018-01-01' & buyers.SaleChannelDescr != 'bQR';

However, the bQR still pops up.

Upvotes: 1

Views: 17

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269483

Start by using proper boolean syntax (rather than bit operators). And if you intend a left join, move the condition on the second table into the on clause:

SELECT *
FROM buyers b LEFT JOIN
     event e
     ON b.fk_tiEvenementID = e.idEvent
WHERE b.tiTransactiedatum >='2018-01-01' AND b.SaleChannelDescr <> 'bQR';

Your query references a table called tickets. I am assuming this is really buyers.

Upvotes: 1

Related Questions