 




<?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; Sub Query</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/tag/sub-query/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers</link>
	<description></description>
	<lastBuildDate>Tue, 21 May 2013 22:12:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>SQL sub query or where exists</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-sub-query-or-where-exists/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/sql-sub-query-or-where-exists/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 14:38:52 +0000</pubDate>
		<dc:creator>Bartbart</dc:creator>
				<category><![CDATA[SQL Server 2003]]></category>
		<category><![CDATA[SQL Server Query]]></category>
		<category><![CDATA[Sub Query]]></category>
		<category><![CDATA[Windows Server 2003]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I am working on with SQL server 2003 and using winsql to access and run the query. In the following query I am trying to get the data for a Part (PMPRNO) that the Material (PMMTNO) is from the supplier &#8220;AMER NAT&#8221; an has a status (MBSTAT) of &#8220;20&#8243;. One other paremeter is I only [...]]]></description>
				<content:encoded><![CDATA[<p>I am working on with SQL server 2003 and using winsql to access and run the query. In the following query I am trying to get the data for a Part (PMPRNO) that the Material (PMMTNO) is from the supplier &#8220;AMER NAT&#8221; an has a status (MBSTAT) of &#8220;20&#8243;. One other paremeter is I only want to see the data if the Part (PMPRNO) has a value &gt;0 in the MITSAT table. the following query give me what I want with the exception of it shows me all data if the MITSTA table has useage (&gt;0)for the PMPRNO or the PMMTNO. How do I get it to select just the items that have a usage for the PMPRNO. select DISTINCT PMPRNO,PMMTNO as Material from MVXJDTA.MPDMAT where MVXJDTA.MPDMAT.PMMTNO in (select MBITNO from MVXJDTA.MITBAL where MBSUNO = &#8216;AMER NAT&#8217; and MBSTAT =&#8217;20&#8242;AND MVXJDTA.MITBAL.MBITNO in (Select MHITNO from MVXJDTA.MITSTA where MHCYP6 Between 200801 and 201102 Group by MHITNO Having SUM(MHMAQT+MHPUQT + MHSOQT + MHUSQT + MHDEMQ) &gt;0))</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/sql-sub-query-or-where-exists/feed/</wfw:commentRss>
		<slash:comments>4</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/9 queries in 0.023 seconds using memcached
Object Caching 314/315 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-22 03:24:46 -->