﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Searching in two tables and add final result to a string / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 21:41:48 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Searching in two tables and add final result to a string</title><link>http://www.sqlservercentral.com/Forums/Topic1392274-391-1.aspx</link><description>Please stop cross posting. You don't need to start a new thread for each follow up question.[url=http://www.sqlservercentral.com/Forums/Topic1392324-391-1.aspx]http://www.sqlservercentral.com/Forums/Topic1392324-391-1.aspx[/url]</description><pubDate>Tue, 04 Dec 2012 08:00:10 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>RE: Searching in two tables and add final result to a string</title><link>http://www.sqlservercentral.com/Forums/Topic1392274-391-1.aspx</link><description>Yes, Using joins..First it need to check in table1, if value found then assign that values to a string,if not found then only it should check in table2.table 1 : Test1ColA	|	Value----------------------A		100Table 2 : Test2ColA	|	Value-----------------------B		200if COLA =A is available in Table1 thenCOLA : A  Value: 100elsecheck in Table2, if availableCOLA : A  Value: 100Query Please...</description><pubDate>Tue, 04 Dec 2012 02:29:12 GMT</pubDate><dc:creator>Minnu</dc:creator></item><item><title>RE: Searching in two tables and add final result to a string</title><link>http://www.sqlservercentral.com/Forums/Topic1392274-391-1.aspx</link><description>[quote][b]Minnu (12/4/2012)[/b][hr]am using below query for searching in table 1, how to include table 2 for searching.[/quote] you need to make JOIN  with second table with first one.</description><pubDate>Tue, 04 Dec 2012 02:19:01 GMT</pubDate><dc:creator>Bhuvnesh</dc:creator></item><item><title>Searching in two tables and add final result to a string</title><link>http://www.sqlservercentral.com/Forums/Topic1392274-391-1.aspx</link><description>Hi Team,I got exact results from Team for whatever i've posted, Very Very thanks.Here my requirement is : I have two tables, table 1 : Test1ColA	|	Value----------------------A		100C		300Table 2 : Test2ColA	|	Value-----------------------B		200D		150if Record "A" is available in table1 then add string to a variable@string = A : 300else search in the table 2Next search for B, it is not available in table 1, then get from table 2@ string = A : 300, B 200am using below query for searching in table 1, how to include table 2 for searching. SELECT RTRIM(          + 'ColA:'+ISNULL(ColA,'')+', '          + ISNULL('ColB:'+CAST(ColB AS VARCHAR(10))+' ','')          + ISNULL('ColC:'+CAST(ColC AS VARCHAR(10))+' ','')          + ISNULL('ColD:'+CAST(ColD AS VARCHAR(10))+' ','')        )   FROMPlease help.........</description><pubDate>Tue, 04 Dec 2012 01:01:45 GMT</pubDate><dc:creator>Minnu</dc:creator></item></channel></rss>