473,379 Members | 1,184 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,379 software developers and data experts.

sum (date < now())?

Hi,

I have an Access db where I retrieve rows :

SELECT
Shipyard,
Shipyard_Country,
Main_Vessel_type,
Count(Main_Vessel_type) AS VesselCount,
Due_Or_Delivered
FROM
tblShip
GROUP BY
Due_Or_Delivered,
Main_Vessel_type,
Shipyard_Country,
Shipyard

The column Due_Or_Delivered contains a date. I want to have in the a
resultset 2 extra columns:
a column containing a number indicating how many of the grouped rows
have a datevalue in the column Due_Or_Delivered that is equal to or
earlier than Now
and
a column containing a number indicating how many of the grouped rows
have a datevalue in the column Due_Or_Delivered that is later than
Now.

I tried

Sum(CASE Due_Or_Delivered When Due_Or_Delivered >= Now() THEN 1 ELSE 1
END CASE) AS Delivered,
Sum(CASE Due_Or_Delivered When Due_Or_Delivered < Now() THEN 1 ELSE 1
END CASE) AS OnOrder,

but Access does not know this.

How can I do this in Access?

Thanks
Jun 27 '08 #1
1 1328
Will this work in your larger query? I don't know.
Thanks, I'm moving again..
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Darren | last post by:
Hello, How would I write in SQL or ASP the following?: Count number of Database Records between NOW and 24 HOURS EARLIER? I know how to retrieve recordsets etc - its just the date thing I cant...
6
by: Adam Knight | last post by:
I have stored a date value using the now function. This stores dates like this: 5/3/2004 3:59:23 PM I am wanting to run a query that compares todays date with the date in the db field. I...
2
by: Joshua C. Clark | last post by:
In ASP I used to be able to use <% now %> to pass the date and time. How is this achieved in .ASPX? I cannot seem to figure this one out.. Thanks in advance!
1
by: Reza | last post by:
Hi I have a column in my datagrid that can have values of null at times. I am not assigning any value to it, if it is coming from Database empty. Now, the problem is I guess the datetime variables...
3
by: yxq | last post by:
Hello, The XP Desktop clean wizard can get the last access time of desktop shortcut, i found that the info come from ...
2
by: yxq | last post by:
There are 8 bytes binary value stored date and time in Registry. 84 8B D7 DF 8B 28 C5 01 I want to convert the binary value to date using VB.NET. Dim a As FILETIME a.dwHighDateTime = 29698187...
0
by: Ulrich Wisser | last post by:
Hi, today I started to wonder about type conversion. I want to get all rows of a table dated between two given dates. Until now I use select * from mytable where to_date('20040115',...
2
by: Jerry | last post by:
I'm trying to automatically fill in the date field in a <FORM>. I've found a couple scripts, both of which work fine in IE, but display the year part as "106" rather than "2006" when viewed with...
3
by: janetopps | last post by:
I have a news website, with asp pages, which was on Access, and i upgraded to MySQL, i used Bullzip to transfer the data. It had about 1000 pages, which im now able to pull up on the public side. Im...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.