 




<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IT Answers &#187; JOIN statement</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/tag/database/join-statement/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers</link>
	<description></description>
	<lastBuildDate>Thu, 23 May 2013 03:54:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Join for merging records</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/join-for-merging-records/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/join-for-merging-records/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 12:08:45 +0000</pubDate>
		<dc:creator>Eabouzeid</dc:creator>
				<category><![CDATA[JOIN statement]]></category>
		<category><![CDATA[SQL Server 2005 Express]]></category>
		<category><![CDATA[SQL Server 2005 merge replication]]></category>
		<category><![CDATA[SQL tables]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I&#8217;m trying to figure out what the best type of join I could use in TSQL for merging records in about 6 tables where there is a match. So I have 6 different tables where there are many matching records. So I figured that I would use a left join in my first join, keep [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m trying to figure out what the best type of join I could use in TSQL for merging records in about 6 tables where there is a match. So I have 6 different tables where there are many matching records. So I figured that I would use a left join in my first join, keep those records that were matched and then seek to join the unmatched records from my first join to my next table and vice versa. Can someone please help? Here is an example of what I&#8217;m writing but I&#8217;m sure I&#8217;m doing something wrong as I get no results. I&#8217;m thinking I need parenthesis somewhere here:</p>
<div></div>
<div>SELECT T.*</div>
<div>FROM TABLE1 T</div>
<div>LEFT OUTER JOIN TABLE2 T2</div>
<div>ON T.KEY=T2.KEY</div>
<div>INNER JOIN TABLE3 T3</div>
<div>ON T.KEY=T3.KEY</div>
<div>WHERE T.KEY IS NULL</div>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/join-for-merging-records/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SQL Join on multiple columns?</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-join-on-multiple-columns/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/sql-join-on-multiple-columns/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 18:50:59 +0000</pubDate>
		<dc:creator>Wlakesearcher</dc:creator>
				<category><![CDATA[AS/400]]></category>
		<category><![CDATA[JOIN statement]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Can I join from one file to another on more than one column? For example, join from FileA to FileB on OrderNumber.A=OrderNumber.B AND ItemNumber.A=ItemNumber.B? All examples show only one column&#8230; I am on an AS400 using RPGLESQL, I need to join from one detail file to another detail file.]]></description>
				<content:encoded><![CDATA[<p>Can I join from one file to another on more than one column? For example, join from FileA to FileB on OrderNumber.A=OrderNumber.B AND ItemNumber.A=ItemNumber.B? All examples show only one column&#8230; I am on an AS400 using RPGLESQL, I need to join from one detail file to another detail file.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/sql-join-on-multiple-columns/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Wrkqry for join files</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/wrkqry-for-join-files/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/wrkqry-for-join-files/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 08:57:36 +0000</pubDate>
		<dc:creator>Mario05</dc:creator>
				<category><![CDATA[JOIN statement]]></category>
		<category><![CDATA[WRKQRY]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Hi, can you help me how to join the two files but the two fields are not the same length e.g. 1st field (left side) is 9 (ex. A005B2589 job#) and the 2nd field (right side) is 11 (ex. A005B258901&#8230; the last two digit 01 is for partial#), kindly advise if it&#8217;s possible?  Thanks and regards&#8230;]]></description>
				<content:encoded><![CDATA[<p>Hi, can you help me how to join the two files but the two fields are not the same length e.g. 1st field (left side) is 9 (ex. A005B2589 job#) and the 2nd field (right side) is 11 (ex. A005B258901&#8230; the last two digit 01 is for partial#), kindly advise if it&#8217;s possible?  Thanks and regards&#8230;<br/><br/></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/wrkqry-for-join-files/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>AS400 Query Join</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/as400-query-join-2/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/as400-query-join-2/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 17:45:56 +0000</pubDate>
		<dc:creator>lorit</dc:creator>
				<category><![CDATA[AS/400 Query]]></category>
		<category><![CDATA[JOIN]]></category>
		<category><![CDATA[JOIN statement]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I need expert help. I need to create a query that will use four tables. Each table has a column of data that I need for the report. The end result should display the following: Name, City, Amount, Reason.  Here is my first query that gives me the name and city: SELECT &#8220;T16.GNAM&#8221;.N_NAME, &#8220;T16.GNAM&#8221;.N_CITY FROM [...]]]></description>
				<content:encoded><![CDATA[<p>I need expert help. I need to create a query that will use four tables. Each table has a column of data that I need for the report. The end result should display the following: Name, City, Amount, Reason. <br/><br/> Here is my first query that gives me the name and city:<br/><br/> SELECT &#8220;T16.GNAM&#8221;.N_NAME, &#8220;T16.GNAM&#8221;.N_CITY FROM QS36F.&#8221;T16.GNAM&#8221; AS &#8220;T16.GNAM&#8221; Join QS36F.&#8221;T16.CPRP&#8221; on QS36F.&#8221;T16.CPRP&#8221;.CP_PRIMARY_TAXPAYER = &#8220;T16.GNAM&#8221;.N_ID_NR ;<br/><br/> Here is my second query that gives me the amount:<br/><br/>  SELECT &#8220;T16.CADJ&#8221;.AD_TOTAL_ADJUSTMENT FROM QS36F.&#8221;T16.CADJ&#8221; AS &#8220;T16.CADJ&#8221; WHERE &#8220;T16.CADJ&#8221;.AD_ADJUSTMENT_DATE &gt; 20091031 AND &#8220;T16.CADJ&#8221;.AD_ADJUSTMENT_DATE &lt; 20091201 AND &#8220;T16.CADJ&#8221;.AD_TOTAL_ADJUSTMENT &gt; 100 and &#8220;T16.CADJ&#8221;.AD_REASON IN (&#8216;R&#8217;, &#8216;C&#8217;); <br/><br/> This gives me the reason:<br/><br/> SELECT &#8220;T16.CRDC&#8221;.RD_COMMENT FROM QS36F.&#8221;T16.CRDC&#8221; AS &#8220;T16.CRDC&#8221; Join QS36F.&#8221;T16.CADJ&#8221; on QS36F.&#8221;T16.CADJ&#8221;.AD_TAXBILL_NO = &#8220;T16.CRDC&#8221;.RD_TAXBILL_NO WHERE QS36F.&#8221;T16.CADJ&#8221;.AD_ADJUSTMENT_DATE &gt; 20091031 AND QS36F.&#8221;T16.CADJ&#8221;.AD_ADJUSTMENT_DATE &lt; 20091201 AND QS36F.&#8221;T16.CADJ&#8221;.AD_TOTAL_ADJUSTMENT &gt; 100 and QS36F.&#8221;T16.CADJ&#8221;.AD_REASON IN (&#8216;R&#8217;, &#8216;C&#8217;);<br/><br/> My question is how do I combine this into one query to generate Name, City, Amount, Reason all in one report?<br/><br/></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/as400-query-join-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AS/400 Query Join</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/as400-query-join/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/as400-query-join/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 21:12:01 +0000</pubDate>
		<dc:creator>lorit</dc:creator>
				<category><![CDATA[AS/400 Query]]></category>
		<category><![CDATA[JOIN statement]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I am joining four files. Each file has one field I need for my report. How do I determine which file is the primary one? Should the select records criteria all come from the primary file? As long as I test fields First&#62;Second, Second&#62;Third, Third&#62;Fourth, shouldn&#8217;t it work just fine?]]></description>
				<content:encoded><![CDATA[<p>I am joining four files. Each file has one field I need for my report. How do I determine which file is the primary one? Should the select records criteria all come from the primary file? As long as I test fields First&gt;Second, Second&gt;Third, Third&gt;Fourth, shouldn&#8217;t it work just fine?</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/as400-query-join/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>get a anr record from databse by using max (one Field) and orderby (one filed) desc</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/get-a-anr-record-from-databse-by-using-max-one-field-and-orderby-one-filed-desc/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/get-a-anr-record-from-databse-by-using-max-one-field-and-orderby-one-filed-desc/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 13:12:40 +0000</pubDate>
		<dc:creator>Workingonswingsanddatabase</dc:creator>
				<category><![CDATA[Database issues]]></category>
		<category><![CDATA[JOIN statement]]></category>
		<category><![CDATA[Oracle Database]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Hi, I have a table. It can have multiple records for the key value. Ex secid   time       source 1       02:04    a 1      02:04    b 2 3 Now i want only one record of secid for a descending orderby of (source) and for a max time stamp. and later i will join the secid with the [...]]]></description>
				<content:encoded><![CDATA[<p>Hi,<br/><br/> I have a table. It can have multiple records for the key value. Ex<br/><br/> secid   time       source<br/><br/> 1       02:04    a<br/><br/> 1      02:04    b<br/><br/> 2<br/><br/> 3<br/><br/> Now i want only one record of secid for a descending orderby of (source) and for a max time stamp.<br/><br/> and later i will join the secid with the other table as a join.<br/><br/> I tried with orderby with rownum=1 option its not working.<br/><br/> Please let me know u t ideas.<br/><br/></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/get-a-anr-record-from-databse-by-using-max-one-field-and-orderby-one-filed-desc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Why are naturl JOIN keywords not an option for producing a self-join?</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ch-4-number-4/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/ch-4-number-4/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 14:16:39 +0000</pubDate>
		<dc:creator>Meganlh</dc:creator>
				<category><![CDATA[JOIN statement]]></category>
		<category><![CDATA[SQL procedure]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[New Answer by Chris Leonard]]></description>
				<content:encoded><![CDATA[New Answer by Chris Leonard]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/ch-4-number-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>query for  join</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/query-for-join/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/query-for-join/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 12:50:14 +0000</pubDate>
		<dc:creator>Rampradeep</dc:creator>
				<category><![CDATA[JOIN statement]]></category>
		<category><![CDATA[SQL Server Query]]></category>
		<category><![CDATA[SQL Server tables]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[i have 2 tables unittypes,rules unittypes has unitid and description unitid description A1 description1 A2 description2 A3 description3 rules has id unitid 1 A1,A2 2 A1,A3 i am trying to get it to get a resultset like 1 description1,description2 2 description1,description3 the sql i wrote was select r.unitid ,(select distinct description from unittypes where unittypes.unitid [...]]]></description>
				<content:encoded><![CDATA[<p>i have 2 tables unittypes,rules</p>
<p>unittypes has unitid  and description</p>
<p>unitid      description</p>
<p>A1         description1<br />
A2         description2<br />
A3         description3</p>
<p>rules has </p>
<p>id         unitid<br />
1           A1,A2</p>
<p>2           A1,A3</p>
<p> i am trying to get it to get a resultset like </p>
<p>1  description1,description2<br />
2  description1,description3</p>
<p>the sql i wrote was </p>
<p> select r.unitid ,(select distinct description from unittypes where<br />
 unittypes.unitid   in  ( (&#8221;&#8221;+ REPLACE(r.unitid,&#8217;,',&#8221;&#8217;,&#8221;&#8217;)+&#8221;&#8221;)  )  FOR XML PATH(&#8221;) )  o<br />
 from  rules r   </p>
<p>it always returns null, can anyone please help me out with the query</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/query-for-join/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Multiple Join Update</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/multiple-join-update/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/multiple-join-update/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 11:47:51 +0000</pubDate>
		<dc:creator>Keltos</dc:creator>
				<category><![CDATA[JOIN statement]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL queries]]></category>
		<category><![CDATA[UPDATE statement]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Hi, my need is to update a table with a join of 2 other tables. The first table (a) has 5 columns (product_id number, ist number, plan number, plan_w number, ist_w number) The second table (b) has 2 columns (prod_group_id number, percent number) The third table (c) has 2 columns (product_id number, prod_group_id number) My [...]]]></description>
				<content:encoded><![CDATA[<p>Hi,</p>
<p>my need is to update a table with a join of 2 other tables. </p>
<p>The first table (a) has 5 columns (product_id number, ist number, plan number, plan_w number, ist_w number)</p>
<p>The second table (b) has 2 columns (prod_group_id number, percent number)</p>
<p>The third table (c) has 2 columns (product_id number, prod_group_id number)</p>
<p>My intention is to update the columns ist_w and plan_w of the first table (a).</p>
<p>a.Plan_w = a.plan * b.percent<br />
a.ist_w  = .ist * b.percent</p>
<p>Every product_id from table a that is in the prod_group of table b shall be updated. Therefor i have to join table b with table c on prod_group_id<br />
and table a with table c on product_id.</p>
<p>How can I achieve this goal?</p>
<p>Thanks in advance!</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/multiple-join-update/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SQL Server Query Help Needed</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-query-help-needed/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-query-help-needed/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 22:39:34 +0000</pubDate>
		<dc:creator>Arlin</dc:creator>
				<category><![CDATA[INNER JOIN]]></category>
		<category><![CDATA[JOIN statement]]></category>
		<category><![CDATA[LEFT JOIN]]></category>
		<category><![CDATA[RIGHT JOIN]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL queries]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server development]]></category>
		<category><![CDATA[SQL Server Query]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I have a table with Inventory transacation records. The table contains both Shipment (outgoing) and Receiving (incoming) transactions. I&#8217;m trying to write a report that lists both Sales Orders that result in Shipment records and Purchase Orders that result in Receiving records. If I link the Inventory Transaction table to the Shipment (Sales Order) tables [...]]]></description>
				<content:encoded><![CDATA[<p>I have a table with Inventory transacation records.<br />
The table contains both Shipment (outgoing) and Receiving (incoming) transactions.<br />
I&#8217;m trying to write a report that lists both Sales Orders that result in Shipment records and Purchase Orders that result in Receiving records.<br />
If I link the Inventory Transaction table to the Shipment (Sales Order) tables and to the Receiving (Purchase Order) tables, I only get one or the other (Sales or Purchasing) records, not both.  Is there a trick to this with Left, Inner and Right joins on the tables or do I need some other approach?</p>
<p>Thanks for the help,<br />
Arlin</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-query-help-needed/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/26 queries in 0.029 seconds using memcached
Object Caching 905/1034 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-23 06:50:05 -->