Hi. I just started my SQL training this week, so some noobines to be expected
I got a task to list up a projects motors and it's spaceheaters, in two coloums. Now, the name of the motor and spaceheater are in one table, and motor and space heater have their own. So I made a code with 3 joins and got the task completed.
Then next challenge was to exclude all hits where the motors and the spaceheater name was the same, just show the hits where the names are not the same.
I have tried WHERE NOT statments here and there, but it fails or come with the same result. Here is my code, hope someone can help me on the way
SELECT pi1.itemtag, pi2.itemtag, h1.heaterratedpower
FROM ekolel.t_plantitem pi1
JOIN ekolel.t_motor m1
on pi1.SP_ID = m1.SP_ID
JOIN ekolel.t_heater h1
on m1.sp_heaterid = h1.SP_ID
JOIN ekolel.t_plantitem pi2
on pi2.SP_ID = h1.SP_ID