473,287 Members | 1,880 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

selecting a date range using query

66
hi friends..

i am using sql server 2005 reporting services..
in database the table contains startdate row and enddate row...
i want the query which display all the contents between these dates... when i externaly pass the startdate and enddate

SELECT *

FROM tmpFilePendStatPost
Where seccd=@seccd
GROUP BY
HAVING (fromdate = CONVERT(smalldatetime, @stdt, 103) AND todate=CONVERT(smalldatetime, @enddt, 103))

but the above query will give only that date contents.... it doesnot display the contents which is present b/w these dates...
how to do this plz help me...
Sep 9 '08 #1
4 2830
ck9663
2,878 Expert 2GB
Use WHERE instead of HAVING

WHERE fromdate = CONVERT(smalldatetime, @stdt, 103) AND todate=CONVERT(smalldatetime, @enddt, 103)
GROUP BY.....

-- CK
Sep 9 '08 #2
rekhasc
66
Use WHERE instead of HAVING

WHERE fromdate = CONVERT(smalldatetime, @stdt, 103) AND todate=CONVERT(smalldatetime, @enddt, 103)
GROUP BY.....

-- CK

but it ll display only that particular fromdate and todate reports, but i want the reports from that start date to enddate, i.e it should display the reports b/w these dates including the start and end date
Sep 10 '08 #3
ck9663
2,878 Expert 2GB
use >= (greater than or equal)

Expand|Select|Wrap|Line Numbers
  1. WHERE fromdate >= CONVERT(smalldatetime, @stdt, 103) AND todate <= CONVERT(smalldatetime, @enddt, 103)
  2. GROUP BY.....
-- CK
Sep 10 '08 #4
rekhasc
66
use >= (greater than or equal)

Expand|Select|Wrap|Line Numbers
  1. WHERE fromdate >= CONVERT(smalldatetime, @stdt, 103) AND todate <= CONVERT(smalldatetime, @enddt, 103)
  2. GROUP BY.....
-- CK

Thank you very much for u r reply.. its working
Sep 11 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sunny K | last post by:
Hi, I am having a problem with aquery. Firstly here is a script to create the table and insert some sample data: CREATE TABLE . ( (17) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , ...
2
by: Catherine | last post by:
I have a database where in my query I need to be able to locate accounts that show a date greater than 14 days from the current date. How would I structure this to allow for all accounts that over...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
3
by: manning_news | last post by:
Using A2K. I've been asked to modify a report currently requiring only one date parameter to now accept a date range. The main report has 2 subreports and is not bound to a table or query. The...
2
by: Julie Wardlow | last post by:
Help! I am calculating a future date using the DateAdd function in a query (the calculation also involves an IIf statement), and have managed to get this formula to produce the required result....
5
by: Miquel van Smoorenburg | last post by:
I have a database with a btree index on the 'removed' field, which is of type 'date'. However it isn't being used: techdb2=> explain select * from lines where removed > CURRENT_DATE; QUERY PLAN...
67
by: PC Datasheet | last post by:
Transaction data is given with date ranges: Beginning End 4/1/06 4/4/06 4/7/06 4/11/06 4/14/06 4/17/06 4/18/06 4/21/06 426/06 ...
4
Sandboxer
by: Sandboxer | last post by:
I want to be able to program Access to provide for me, by individual day, what my contract obligations are to my customers. Will Access recognize all the individual days in between a date range...
9
by: trixxnixon | last post by:
this may not make any sense, but here goes... i have a form based on a query that pulls its paramater criteria from drop down boxes on a form. im using a date range, and i can get this to run...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.