I'm trying to fetch some data from an db. I've got an Taak
table with an possible idPartij
column. Possible, because it can be an real idPartij
, but can also be null
.
The query I've got:
SELECT T.idTaak,
T.Taaktype,
P.Partijnaam,
T.Naar,
T.UltimatumDatum,
T.Opmerking,
T.Status,
T.Prioriteit
FROM Taak AS T,
Partij AS P
WHERE T.idPartij = P.idPartij
ORDER BY idTaak DESC
This is working fine when I've got an id in T.idPartij
, but as mentioned earlier, that id can be null
. And when that is the case, the row won't be in the result.
Only problem: When I remove the where clause, I get the rows a lot ( because the Partij
table isn't filtered anymore...
I'm an total noob at SQL, so i can't think of an way to "fix" this problem. Only thing i can think of is creating 2 query's, but i don't think that is an nice way to do...