Joining two tables and getting values

Viewed 380

I have two config tables. The structure is as below:

Table 1: Client_Config
id, name, value, type, description

Table 2: App_Config
name, value, type, description

I want to get name and value from Client_config table where id = @id.

I also want to get name and values from App_config for rows where there are no entries(matched with name) in client_config. Values for the same name can be different in both the tables.

eg: Values in Client_Config

1, testName, testValue, testType, testDescription
1, testName1, testValue1, testType1, testDescription1
1, testName2, testValue2, testType2, testDescription2

Values in App_Config

testName, testValue1, testType, testDescription
testName1, testValue1, testType1, testDescription1
testName2, testValue2, testType2, testDescription2
testName3, testValue3, testType3, testDescription3

In the result set I need the following rows:

1, testName, testValue, testType, testDescription
1, testName1, testValue1, testType1, testDescription1
1, testName2, testValue2, testType2, testDescription2
NULL, testName3, testValue3, testType3, testDescription3
4 Answers
Related