Showing posts with label naic. Show all posts
Showing posts with label naic. Show all posts

Friday, March 23, 2012

Help with Select query

This should be simple I think but I am no expert so maybe one of you will have the kindness to help me a bit. I have two tables(System, NAIC) and both have the primary key SystemId.

I need to gell all the rows from the table system and anything that correspond from the table NAIC, if no correspondant systemId the return "" or nothing in the fields of NAIC

Thank you,

Table:
System
-SystemId*
-Company
-Reseller
-SystemType
...

NAIC
-SystemId*
-NAIC_1
-NAIC_2
-NAIC_3
-NAIC_4

I think what you need is a basic LEFT JOIN.

SELECT

SystemId
Company
Reseller
SystemType

...

FROM

[system]

LEFT OUTER JOIN NAIC

ON [System].Systemid = NAIC.SystemId


sql