Skip to content
Advertisement

Return Data based on Column

I am modifying a current query which returns n amount of rows. I would need to return the same amount of rows but with one more column of data.

I have two sql tables shown below. Products and Product Attribute Values. When i run this query

i get a few 1000 rows back. But when i run this query

I get back less rows.

My question is how would i get back all the rows from the products table that match the DealerRowId and any rows from the Product Attribute Value tables that match on serial no, i would expect that any product that does not have a serial to return null.

enter image description here

Advertisement

Answer

You want to move the condition on the second table to the on caluse:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement