July 9, 2013 at 12:27 pm
I hae to update the tableA. Server names are same in both tables but in tableB we have more Appnames for the same severs. So, I have to pull those AppNames with server names. Here I am showing the samll example.
We need to get the missing appnames from tableB
TableA
Server ||||| AppName
ServerA ||||| App1
ServerB ||||| App2
ServerC ||||| App3
ServerD ||||| App4
ServerE ||||| App5
TableB
Server ||||| AppName
ServerA ||||| App1
ServerA ||||| App11
ServerA ||||| App111
ServerB ||||| App2
ServerB ||||| App22
ServerC ||||| App3
ServerC ||||| App33
ServerD ||||| App4
ServerD ||||| App44
ServerD ||||| App444
ServerE ||||| App5
ServerE ||||| App55
ServerE ||||| App555
Required Output in Table A
Server ||||| AppName
ServerA ||||| App1
ServerA ||||| App11
ServerA ||||| App111
ServerB ||||| App2
ServerB ||||| App22
ServerC ||||| App3
ServerC ||||| App33
ServerD ||||| App4
ServerD ||||| App44
ServerD ||||| App444
ServerE ||||| App5
ServerE ||||| App55
ServerE ||||| App555
Please help me.
Thanks
July 9, 2013 at 12:35 pm
Pretty sparse on solid details but I think I get the gist.
select *
from tableb b
LEFT join tablea a on a.Server = b.Server and a.AppName = b.AppName
where a.AppName IS NULL
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
July 9, 2013 at 1:34 pm
Thank you folks..I appreicate your help.
That query absolutely worked for me.
July 9, 2013 at 1:37 pm
DBA12345 (7/9/2013)
Thank you folks..I appreicate your help.That query absolutely worked for me.
You are welcome. Glad you got it sorted out.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply