﻿<?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 / T-SQL (SS2K8)  / Need help to eliminate values from resultant record using view / 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>Tue, 21 May 2013 06:42:38 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Need help to eliminate values from resultant record using view</title><link>http://www.sqlservercentral.com/Forums/Topic1370670-392-1.aspx</link><description>[quote][b]maida_rh (10/10/2012)[/b][hr]I tried ur solution but stilll code return the same result  as my query return ....[/quote][code="sql"]	AND NOT (		actiontype in ('withdrawn','Discontinued','Matured','Withdrawn from Public') 		AND rhdate &amp;lt; (select getdate()-1095)	)[/code]This [i]will [/i]return rows where actiontype is in 'withdrawn','Discontinued','Matured','Withdrawn from Public', but only if they are more recent than 1095 days ago. I think you are getting confused with the logic. Try writing down the rules - for us - it will probably help you too.</description><pubDate>Wed, 10 Oct 2012 04:08:34 GMT</pubDate><dc:creator>ChrisM@home</dc:creator></item><item><title>RE: Need help to eliminate values from resultant record using view</title><link>http://www.sqlservercentral.com/Forums/Topic1370670-392-1.aspx</link><description>[quote][b]maida_rh (10/10/2012)[/b][hr]I tried ur solution but stilll code return the same result  as my query return ....[/quote]Please send some sample data and result obtained and the result expected...</description><pubDate>Wed, 10 Oct 2012 04:01:59 GMT</pubDate><dc:creator>PiMané</dc:creator></item><item><title>RE: Need help to eliminate values from resultant record using view</title><link>http://www.sqlservercentral.com/Forums/Topic1370670-392-1.aspx</link><description>I tried ur solution but stilll code return the same result  as my query return ....</description><pubDate>Wed, 10 Oct 2012 03:40:43 GMT</pubDate><dc:creator>maida_rh</dc:creator></item><item><title>RE: Need help to eliminate values from resultant record using view</title><link>http://www.sqlservercentral.com/Forums/Topic1370670-392-1.aspx</link><description>[code="sql"]SELECT * FROM Vu_CurRating WHERE CatId &amp;lt;&amp;gt; 7	AND NOT (		actiontype in ('withdrawn','Discontinued','Matured','Withdrawn from Public') 		AND rhdate &amp;lt; (select getdate()-1095)	)	AND NOT (		ltrating LIKE 'D%' 		AND rhdate &amp;lt; (select getdate()-365)	)ORDER BY SectorCode, companyname,CatId[/code]</description><pubDate>Wed, 10 Oct 2012 01:09:35 GMT</pubDate><dc:creator>ChrisM@home</dc:creator></item><item><title>Need help to eliminate values from resultant record using view</title><link>http://www.sqlservercentral.com/Forums/Topic1370670-392-1.aspx</link><description>I want to eliminate ('withdrawn','Discontinued','Matured','Withdrawn from Public') from the resultant records but not succeedQUERY :[code="sql"]select * from Vu_CurRating where ratingid not in(select ratingid from Vu_CurRating where actiontype in ('withdrawn','Discontinued','Matured','Withdrawn from Public') and rhdate &amp;lt; (select getdate()-1095)) andCatId !=7  and ratingid not in(select ratingid from Vu_CurRating where ltrating like 'D%' and rhdate&amp;lt;(select getdate()-365)) order by SectorCode, companyname,CatId[/code]I want this query like this as it is not eliminating actiontype('withdrawn','Discontinued','Matured','Withdrawn from Public')  from the resultant records for this I edit the query :[code="sql"]select * from Vu_CurRating where ratingid not in((select ratingid from Vu_CurRating where actiontype in ('withdrawn','Discontinued','Matured','Withdrawn from Public') andselect ratingid from Vu_CurRating where actionId in ('withdrawn','Discontinued','Matured','Withdrawn from Public') )and rhdate &amp;lt; (select getdate()-1095)) andCatId !=7  and ratingid not in(select ratingid from Vu_CurRating where ltrating like 'D%' and rhdate&amp;lt;(select getdate()-365)) order by SectorCode, companyname,CatId[/code]but still no change except when I change :[code="sql"]select * from Vu_CurRating where ratingid not in((select ratingid from Vu_CurRating where actiontype in ('withdrawn','Discontinued','Matured','Withdrawn from Public') andselect ratingid from Vu_CurRating where actionId in ('withdrawn','Discontinued','Matured','Withdrawn from Public') )) andCatId !=7  and ratingid not in(select ratingid from Vu_CurRating where ltrating like 'D%' and rhdate&amp;lt;(select getdate()-365)) order by SectorCode, companyname,CatId[/code][code="sql"][b]and rhdate &amp;lt; (select getdate()-1095)[/b][/code]Any solution to this  ?Thanks in advance</description><pubDate>Tue, 09 Oct 2012 22:52:35 GMT</pubDate><dc:creator>maida_rh</dc:creator></item></channel></rss>