Thursday, 15 May 2014

Adding column value dynamically in select statement SQL Query -


I have 2 sql table types like

Table1

  server name downloaded failed reboot reclaimed server 1 3 2 Yes server 2 4 1No  

Table 2

  Server Name Administrator Server 1 John Server 3 Alex  

I want to join these 2 tables so that I can remove the admin name of Table 2.

If the server name of Table 1 does not match with the table 2 server, then I retain all the columns server name, download, fail, reboot required, administrator (which will be empty) Want .

If the name of the server should be included in the table 2 with all the names in the name of the server name?

How can we do this with a select statement in SQL? I'm quite new to it, and not sure how to use conditional statements in SQL

You use left interlink . For more information about

, go to  tables1  and  table2  on  server name . 

Code> Server Name, downloaded, unsuccessful, Reboot Required, Choose Table 1 T1 Administrator, Include T2 on T1 in T2. Server Name = T2 Server name


No comments:

Post a Comment