﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Reporting Services / Reporting Services  / Query to Select data from a single table with mutliple conditions / 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>Wed, 19 Jun 2013 07:23:25 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Query to Select data from a single table with mutliple conditions</title><link>http://www.sqlservercentral.com/Forums/Topic1424432-150-1.aspx</link><description>Hi Pete,Thanks for the reply.I figured it out by using it in this format.WHERE ([FTS Yearly Query].Dept = "3310" ) and ( ([FTS Yearly Query].Account &amp;gt;= 847000 and [FTS Yearly Query].Account &amp;lt;=847900 or  [FTS Yearly Query].Account = 821000) and (Year([FTS Yearly Query].[Document Date])* 12 + DatePart("m", [FTS Yearly Query].[Document Date]) = Year(Date())* 12 + DatePart("m", Date()) - 1)Regards,Renato</description><pubDate>Thu, 28 Feb 2013 09:37:15 GMT</pubDate><dc:creator>renato_mech_334</dc:creator></item><item><title>RE: Query to Select data from a single table with mutliple conditions</title><link>http://www.sqlservercentral.com/Forums/Topic1424432-150-1.aspx</link><description>[quote][b]renato_mech_334 (2/27/2013)[/b][hr]Where the document data would be the previous month,there would be multiple accounts: for eg: [FTS Yearly Query].Account &amp;gt;= 847000 and [FTS Yearly Query].Account &amp;lt;=847900 or [FTS Yearly Query].Account = 821000 and multiple depts as well.[/quote]Hi:Your question is a little difficult to understand, unfortunately. But, here's a quick observation I'll share -- if the example criteria you've listed is taken from the sql code, then your results won't likely be as intended. From your example, I think you might try the following with parentheses:([FTS Yearly Query].Account &amp;gt;= 847000 and [FTS Yearly Query].Account &amp;lt;=847900) or [FTS Yearly Query].Account = 821000--pete</description><pubDate>Thu, 28 Feb 2013 06:23:45 GMT</pubDate><dc:creator>peterzeke</dc:creator></item><item><title>Query to Select data from a single table with mutliple conditions</title><link>http://www.sqlservercentral.com/Forums/Topic1424432-150-1.aspx</link><description>Hi,I have a table with the below column headings.Business Unit	Document ID	Document Date	Year	Period	Account	Descr	Dept	Product	Project	Analysis Code	Affiliate	Currency	Base Amount	USD Amount	Line Descr	Reference	Vendor	Vendor Name	Module	Doc Line #	AP Distrib Line #	Post Status	SeqI need to pull data with the document date, account and dept.Where the document data would be the previous month,there would be multiple accounts: for eg: [FTS Yearly Query].Account &amp;gt;= 847000 and [FTS Yearly Query].Account &amp;lt;=847900 or [FTS Yearly Query].Account = 821000 and multiple depts as well.and it do not get the required data.Could someone please help me.</description><pubDate>Wed, 27 Feb 2013 03:26:13 GMT</pubDate><dc:creator>renato_mech_334</dc:creator></item></channel></rss>