I'm trying to figure out what this SQL query is doing, more specifically in the part that starts after NOT EXISTS:
SELECT
order_num,
MIN(order_date)
FROM
orders
WHERE
order_date >= '01.01.2019'
AND
NOT EXISTS
(
SELECT
NULL
FROM
result
WHERE
unique_id = '201895'
AND
result = order_num
)
GROUP BY
order_num
SELECT NULL still returns rows from the query. It does the same as if it was:
[...] EXISTS( SELECT 1 FROM [...]
or
[...] EXISTS( SELECT Id FROM [...]
It's just one way to make it clear that the value is not used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With