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

two sets of data in one query

I want to query one table and get back two simple sets of data with one
query. I have a table with date start, date ended,
scheduled/unscheduled. I want to be able to get all of the dates
within a particular month and separate them out but scheduled or
unscheduled. so the result of the query would look like

Scheduled Unscheduled
June 5 7
July 2 1
August 8 15
I already figured out how to separate things out by 1 month its just
the sorting by scheduled/unscheduled that is the problem and putting
them in two different fields with all months

so my output so far look like

june 25

Thanks

Jun 27 '06 #1
5 1745
Sounds like you're going to want to use a sum query. Group by
month(date), count(scheduled = yes), count(scheduled = no).

What happens if start date and end date don't fall in the same month?
BlackIce wrote:
I want to query one table and get back two simple sets of data with one
query. I have a table with date start, date ended,
scheduled/unscheduled. I want to be able to get all of the dates
within a particular month and separate them out but scheduled or
unscheduled. so the result of the query would look like

Scheduled Unscheduled
June 5 7
July 2 1
August 8 15
I already figured out how to separate things out by 1 month its just
the sorting by scheduled/unscheduled that is the problem and putting
them in two different fields with all months

so my output so far look like

june 25

Thanks


Jun 27 '06 #2
Could you give me some more detail on how to setup the query?
Thanks

Jun 27 '06 #3
Hmmm...

Build a new query, bring in your table, and click the Sum button (it
looks like an "E", usually not far from the red "exclamation point"
button).

You'll have to write a new field that will look something like,
MthField: month(StartDate) and on the 3rd line down click the dropdown
and choose "Group By" (it may default to it).

Set up another field that looks something like, Sel: iif(Selected =
yes, 1, 0) and on the 3rd line down click the dropdown and choose
"Sum".

Set up another field that looks something like, UnSel: iif(Selected =
no, 1, 0) and on the 3rd line down click the dropdown and choose "Sum".

This should group by month and total up all the selected and unselected
records.

This code isn't exact, it will require a little tweaking, but it's 90%
done. As a rule I never do 100% of the work for someone unless I'm
getting paid for it.

BlackIce wrote:
Could you give me some more detail on how to setup the query?
Thanks


Jun 27 '06 #4
I appologise, I must have mistated my question, but there is a field in
the DB that has text that will be "scheduled" or "unscheduled" i solved
the problem though so thanks for all your help.

SELECT
Count(IIf([RecordedDownTime.Scheduled_Unscheduled]="Scheduled",0)) AS
Sched,
Count(IIf([RecordedDownTime.Scheduled_Unscheduled]="Unscheduled",0)) AS
Unsched
FROM RecordedDownTime
WHERE (((Month([Start_Date]))=6));

Jun 27 '06 #5
Don't be turned off by someone who won't fully answer a question in the
newsgroup. There are many who give detailed, complete answers, if the poster
provides sufficient detail.

Larry Linson
Microsoft Access MVP

"BlackIce" <Bl*********@gmail.com> wrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
I appologise, I must have mistated my question, but there is a field in
the DB that has text that will be "scheduled" or "unscheduled" i solved
the problem though so thanks for all your help.

SELECT
Count(IIf([RecordedDownTime.Scheduled_Unscheduled]="Scheduled",0)) AS
Sched,
Count(IIf([RecordedDownTime.Scheduled_Unscheduled]="Unscheduled",0)) AS
Unsched
FROM RecordedDownTime
WHERE (((Month([Start_Date]))=6));

Jun 27 '06 #6

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

Similar topics

0
by: Dave Benjamin | last post by:
Hola, I made a backport of sets.py that will run on Jython 2.1. Here is a diff against the Python 2.3 version of sets.py. The changes were simple, but I may have made a mistake here or there,...
12
by: NickName | last post by:
I have the following situation. One set of data has 274 rows (set2) and anther has 264 (set1). Both data sets are similar in structure as well as values for both of them were extracts from the...
2
by: User 2084 | last post by:
Hello all. I'm an access newbie trying to learn how to do basic database data manipulations. I had a hard time searching the archives on this question as I don't really know what I'm looking for in...
2
by: Alec | last post by:
First attempt at doing an exercise on paginating result sets When I run the code, I receive the error "Fatal error: Call to undefined function: mysql_fetch_objects() in...
19
by: Genalube | last post by:
I have an application that will produce a Word document based on five separate queries this has required that I create a ADODB connection: 'Create connection to current database Dim Conn As...
3
by: esmith2112 | last post by:
Scratching my head on an issue that has been plaguing us ever since we upgraded from version to version 8. Our db2diag file gets inundated with messages that take the form: MESSAGE :...
11
by: Prateek | last post by:
I have 3 variable length lists of sets. I need to find the common elements in each list (across sets) really really quickly. Here is some sample code: # Doesn't make sense to union the sets -...
15
by: CMOS | last post by:
one of the projects im working in currently requires use of ultra large sized maps, lists, vector, etc. (basically stl containers). Sizes might grow up to 1000 Million entries. since it is...
0
by: anilkodali | last post by:
How to compare multiple result sets with a set of values? Here is the scenario.. My query returns me multiple results(one column of data) and I want compare all the data at once with a set of...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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.