 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Compare part of string to field</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/compare-part-of-string-to-field/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/compare-part-of-string-to-field/</link>
	<description></description>
	<lastBuildDate>Sun, 19 May 2013 03:14:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: keithbrc</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/compare-part-of-string-to-field/#comment-107534</link>
		<dc:creator>keithbrc</dc:creator>
		<pubDate>Wed, 16 May 2012 08:04:46 +0000</pubDate>
		<guid isPermaLink="false">#comment-107534</guid>
		<description><![CDATA[Understood.  That&#039;s fine in this case as F2 is a list of branches that I want to query anyway, so my intention is only to get matches in both files.  Thanks again for your solution.]]></description>
		<content:encoded><![CDATA[<p>Understood.  That&#8217;s fine in this case as F2 is a list of branches that I want to query anyway, so my intention is only to get matches in both files.  Thanks again for your solution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/compare-part-of-string-to-field/#comment-107525</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Wed, 16 May 2012 00:56:22 +0000</pubDate>
		<guid isPermaLink="false">#comment-107525</guid>
		<description><![CDATA[The Join you&#039;ve choosen is an inner join, it will only show rows from F1 and F2 where there are matches in both files.
Phil]]></description>
		<content:encoded><![CDATA[<p>The Join you&#8217;ve choosen is an inner join, it will only show rows from F1 and F2 where there are matches in both files.<br />
Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: keithbrc</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/compare-part-of-string-to-field/#comment-107504</link>
		<dc:creator>keithbrc</dc:creator>
		<pubDate>Tue, 15 May 2012 08:13:49 +0000</pubDate>
		<guid isPermaLink="false">#comment-107504</guid>
		<description><![CDATA[Genius!  It worked although I had to modify it slightly as below:

select ornum,custpo,branch                
from orders f1, branches f2 
where custpo like &#039;%&#039;&#124;&#124;trim(f2.branch)&#124;&#124;&#039;%&#039;
and ordat between 1110101 and 1111231     
and orcus = &#039;AA11&#039;                        
order by ornum 

many thanks]]></description>
		<content:encoded><![CDATA[<p>Genius!  It worked although I had to modify it slightly as below:</p>
<p>select ornum,custpo,branch<br />
from orders f1, branches f2<br />
where custpo like &#8216;%&#8217;||trim(f2.branch)||&#8217;%&#8217;<br />
and ordat between 1110101 and 1111231<br />
and orcus = &#8216;AA11&#8242;<br />
order by ornum </p>
<p>many thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/compare-part-of-string-to-field/#comment-107499</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Mon, 14 May 2012 20:48:35 +0000</pubDate>
		<guid isPermaLink="false">#comment-107499</guid>
		<description><![CDATA[Perhaps something like one of these?

Select po_ref, branch, br_desc 
from f1, f2
where po_ref like &#039;%&#039; &#124;&#124; TRIM(branch) &#124;&#124; &#039;%&#039;

or 

Select po_ref, branch, br_desc 
from f1 left join f2
on po_ref like &#039;%&#039; &#124;&#124; TRIM(branch) &#124;&#124; &#039;%&#039;]]></description>
		<content:encoded><![CDATA[<p>Perhaps something like one of these?</p>
<p>Select po_ref, branch, br_desc<br />
from f1, f2<br />
where po_ref like &#8216;%&#8217; || TRIM(branch) || &#8216;%&#8217;</p>
<p>or </p>
<p>Select po_ref, branch, br_desc<br />
from f1 left join f2<br />
on po_ref like &#8216;%&#8217; || TRIM(branch) || &#8216;%&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: deepu9321</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/compare-part-of-string-to-field/#comment-107488</link>
		<dc:creator>deepu9321</dc:creator>
		<pubDate>Mon, 14 May 2012 13:12:52 +0000</pubDate>
		<guid isPermaLink="false">#comment-107488</guid>
		<description><![CDATA[Hi Keith,

Am not sure whether it will be helpful for you if you are directly running SQL.
But, I hope it can do some help if you require this process to be done programatically(through SQLRPGLE).

Step1: You can build a curson on FILE2(which holds Branch Number) and Fetch the Branch ID.
SELECT BRNID FROM FILE2
Build Cursor, fetch from cursor(Cursor1). Then follow Step2.
Step2: Build a query on FILE1 for retrieving the details which are related to that Branch Number.
SQLSTMT = &#039;SELECT * FROM FILE1 WHERE CUSTID LIKE %&#039; + BRNID + &#039;%&#039;
Prepare a cursor and Read the records which are matching with that branch number
Perform required operation till EOF(SQLCOD = 100).
Step3: Fetch Next from Cursor1(on FILE2) and perform Step2.

Let me know if you are not clear or if you are looking for different requirement.

Pradeep.]]></description>
		<content:encoded><![CDATA[<p>Hi Keith,</p>
<p>Am not sure whether it will be helpful for you if you are directly running SQL.<br />
But, I hope it can do some help if you require this process to be done programatically(through SQLRPGLE).</p>
<p>Step1: You can build a curson on FILE2(which holds Branch Number) and Fetch the Branch ID.<br />
SELECT BRNID FROM FILE2<br />
Build Cursor, fetch from cursor(Cursor1). Then follow Step2.<br />
Step2: Build a query on FILE1 for retrieving the details which are related to that Branch Number.<br />
SQLSTMT = &#8216;SELECT * FROM FILE1 WHERE CUSTID LIKE %&#8217; + BRNID + &#8216;%&#8217;<br />
Prepare a cursor and Read the records which are matching with that branch number<br />
Perform required operation till EOF(SQLCOD = 100).<br />
Step3: Fetch Next from Cursor1(on FILE2) and perform Step2.</p>
<p>Let me know if you are not clear or if you are looking for different requirement.</p>
<p>Pradeep.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: keithbrc</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/compare-part-of-string-to-field/#comment-107483</link>
		<dc:creator>keithbrc</dc:creator>
		<pubDate>Mon, 14 May 2012 11:30:23 +0000</pubDate>
		<guid isPermaLink="false">#comment-107483</guid>
		<description><![CDATA[Usually either first or last few characters - the branch id portion is normally either 2 or 3 characters.  Sometimes a different delimiter i.e. &#039;/&#039; instead of &#039;-&#039; or no delimiter at all.  I realise it&#039;s going to be a pretty fuzzy search.]]></description>
		<content:encoded><![CDATA[<p>Usually either first or last few characters &#8211; the branch id portion is normally either 2 or 3 characters.  Sometimes a different delimiter i.e. &#8216;/&#8217; instead of &#8216;-&#8217; or no delimiter at all.  I realise it&#8217;s going to be a pretty fuzzy search.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bigkat</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/compare-part-of-string-to-field/#comment-107481</link>
		<dc:creator>bigkat</dc:creator>
		<pubDate>Mon, 14 May 2012 11:24:21 +0000</pubDate>
		<guid isPermaLink="false">#comment-107481</guid>
		<description><![CDATA[that is either the first two or last two characters, but may vary on each record]]></description>
		<content:encoded><![CDATA[<p>that is either the first two or last two characters, but may vary on each record</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bigkat</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/compare-part-of-string-to-field/#comment-107480</link>
		<dc:creator>bigkat</dc:creator>
		<pubDate>Mon, 14 May 2012 11:22:40 +0000</pubDate>
		<guid isPermaLink="false">#comment-107480</guid>
		<description><![CDATA[is it always the first two or last two characters you need to join to?]]></description>
		<content:encoded><![CDATA[<p>is it always the first two or last two characters you need to join to?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.014 seconds using memcached
Object Caching 366/369 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-19 09:27:01 -->