Hopefully this is the right section and I've no idea how to title this. I'm new to sql. Getting to grips - slowly.
Need help please
I have a table WIRES with columns ID(key), WTYPE, WSIZE.
Also have a table PARTS with columns ID(key), PNAME, WIRES_ID
Then I do a
SELECT WIRES.WTYPE, WIRES.WSIZE, PARTS.PNAME
FROM WIRES
LEFT JOIN PARTS
ON WIRES.ID = PARTS.WIRES_ID
This correctly gives me a list of wires and part names using them.
I get null for PNAME when a wire has no using part. correct.
But how can i filter out all rows where PNAME is null but only when there is another row with matching WTYPE WSIZE pair which has a PNAME not null
e.g.
WTYPE WSIZE PNAME
CH 1 null <-- this line to be removed
CH 1 Bolt
TY 3 Nut
etc.
WTYPE WSIZE PNAME
CH 1 null <-- this line NOT to be removed
TY 3 Nut
etc.