473,624 Members | 2,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with a sql query between date ranges

12 New Member
I am trying to filter this query based on date ranges but it don't seem to be working correctly, its probably something really simple if anyone can help me with this

Expand|Select|Wrap|Line Numbers
  1. select ReceivedDate,orderstatus WHERE RecieveDate BETWEEN ''20071101' AND '20071231'
  2.         ,count(case when dcoc = '88' then 1 end) as cnt88
  3.         ,sum(case when dcoc = '88' then ordertotal end) as sls88
  4. from orders
  5. group by ReceivedDate,orderstatus
  6. order by ReceivedDate,orderstatus
Dec 11 '07 #1
1 2180
cryptotech2000
12 New Member
I am trying to filter this query based on date ranges but it don't seem to be working correctly, its probably something really simple if anyone can help me with this

Expand|Select|Wrap|Line Numbers
  1. select ReceivedDate,orderstatus WHERE RecieveDate BETWEEN ''20071101' AND '20071231'
  2.         ,count(case when dcoc = '88' then 1 end) as cnt88
  3.         ,sum(case when dcoc = '88' then ordertotal end) as sls88
  4. from orders
  5. group by ReceivedDate,orderstatus
  6. order by ReceivedDate,orderstatus
Nevermind was a stupid question lol I figured it out needed to have the date range on the from orders line
Dec 11 '07 #2

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

Similar topics

2
776
by: bobb | last post by:
Is there a way to select count(*) by grouping by date, and having multiple date ranges? combining... select field,count(*) from table where datefield > 2004/1/1 and datefield < 2004/1/31 and select field,count(*) from table where datefield > 2004/2/1 and datefield < 2004/2/29
2
1465
by: Gregory Konev | last post by:
Hello, All! Example. I have a table with information about payments (id, amount, pay_date, customer_id). Can I select two sums for two different date ranges, grouped by 'customer_id' (for each customer) in one query? -- With best regards, Gregory Konev. E-mail: voyage@ml.net.ua
2
2528
by: Jeff Blee | last post by:
I am hoping someone can help me. I am making a Access 97 app for a person and have run up against a problem to do with MS Graph. There is a table that has a number of data elements and a date field and entries are entered each month. A graph is required that has three of the data elements represented basically on the y axis and time as months along the x axis. So for each month there is a group of three columns representing the data...
17
25893
by: Lapchien | last post by:
My table has a record called date/time - filled (not surprisingly) with a date and time. I can format the date in one query field, also the time, using format in an expression. My user wants me to provide a listing of all table entries between 22:00 and 07:30 the next day, between a given set of dates (typically one week apart but in practice between any dates specified). My query works ok for 1 date - entering 2 dates, one for 22:00 -...
1
2231
by: Dalan | last post by:
I have attempted to resolve a problem regarding erroneous output using a Between And parameter on several Access 97 queries, but to no avail. The queries are used for report output and regardless of the beginning and ending dates entered, the reports show all activity including before and after the dates entered. There is a frmAccount and two subforms sfrmPurchase and sfrm Sales. In order to isolate costs for each collectively, both...
11
3137
by: Andy_Khosravi | last post by:
My problem: I'm having trouble with a query taking much too long to run; a query without any criteria evaluating only 650 records takes over 300 seconds to run (over the network. On local drive takes 120 seconds). The Setup: I'm running Access 97 non-developer edition. I have exactly zero other tools to use and no way to change that =(. My database is compiled and resides on a network drive. The database has not been split into a...
22
5004
by: boliches | last post by:
I am trying to get a crosstab query (in access 2000) to group data by date range. TRANSFORM Sum(tblInvoice.InvBalance) AS SumOfInvBalance SELECT tblInvoice.DealerID, Sum(tblInvoice.InvBalance) AS FROM tblInvoice GROUP BY tblInvoice.DealerID PIVOT Format(Now(),"ww"); I know the above code is wrong! My question is how do I get the query to group outstanding Invoice Balances (InvBalance) into the following date ranges (InvDate): 0 - 29...
0
1721
by: feeblemind | last post by:
Hi everyone, I am having problem/troubles with creating an sql inline statement for our application. How do I create a statement/query that selects list of servers with defined date ranges, but once a server of the same name has date ranges within the date range of another, I will have to get the date range that contains them all. For easy understanding here's a snapshot of data (the Before and After screenshots). BEFORE: Id ServerName...
16
7242
by: Alex30093 | last post by:
OK This is my 1st post to any forum, but I rely on forums all the time. Short story is I find myself needing to become a Access DBA for work. Situation: I want to use one table of events that Track (Employee ID, Employee Name, Event Date and Trip Hours) And be able to add the fields(Week #1, Week #2, Week#3, week #4 and Week #5). *****There is also an Autonumbered (Trip Numebr). What I have tried: I can run this as a query (Employee ID,...
0
8251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8688
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7178
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6115
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.