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

Reporting with multiple queries

I've inherited a project from someone in my church and I'm trying to put it in Access 2003. Records contain individual names along with a True/False indicator for each of about 30 different church activites. I want to produce a report for each activity, indicating which names are participating in that activity. Names usually participate in more than one activity. (But I have only one record for each name.)
I don't know SQL. Can someone point me in the write direction?
--arlo
Nov 30 '06 #1
6 1365
nico5038
3,080 Expert 2GB
OK, let's assume you have a table named tblMember with the fields:

MemberName
Activity1
Activity2
Activity3

Now we can build a UNION query like:

select Membername, 1 as Origin, Activity1 from tblMember
UNION
select Membername, 2 as Origin, Activity2 from tblMember
UNION
select Membername, 3 as Origin, Activity3 from tblMember;

The Origin field can be used to distinguish between the activities and could also be a text field with the name of the activity.
On this field you can filter to get the correct members per activity listed.

Getting the idea ?

Nic;o)
Nov 30 '06 #2
NeoPa
32,556 Expert Mod 16PB
For each activity that you want to report on your query can be of the form :
Expand|Select|Wrap|Line Numbers
  1. SELECT MemberName
  2. FROM tblMember
  3. WHERE (Activityn)
Where Activityn selects the activity you want.
Dec 1 '06 #3
OK, let's assume you have a table named tblMember with the fields:

MemberName
Activity1
Activity2
Activity3

Now we can build a UNION query like:

select Membername, 1 as Origin, Activity1 from tblMember
UNION
select Membername, 2 as Origin, Activity2 from tblMember
UNION
select Membername, 3 as Origin, Activity3 from tblMember;

The Origin field can be used to distinguish between the activities and could also be a text field with the name of the activity.
On this field you can filter to get the correct members per activity listed.

Getting the idea ?

Nic;o)
Thank you, Nic;o. I'm a real SQL newbie and I'm afraid I don't know enough SQL to grasp what looks like a straight-forward approach. If it's not too much trouble, could you explain what your suggested 'select' statements are doing. The "n as Origin" is throwing me.
--arlo
Dec 2 '06 #4
For each activity that you want to report on your query can be of the form :
Expand|Select|Wrap|Line Numbers
  1. SELECT MemberName
  2. FROM tblMember
  3. WHERE (Activityn)
Where Activityn selects the activity you want.
Thank you. As you realize by now, I'm a rank beginner and I really appreciate this site. What I'm trying to do is generate a single report that will include all activities. I don't want to run a different report for each of 30 activities. What steps would I add to your approach to generate the complete report?
--arlo
Dec 2 '06 #5
NeoPa
32,556 Expert Mod 16PB
In that case Nico's approach is perfect for you.
Try it out and you'll probably get what it's doing for you.
If not, come back explaining what you've got and what you need to understand better.
Dec 2 '06 #6
nico5038
3,080 Expert 2GB
Your table is what we call "not normalized".
The "proper" setup would have been a table with for each activity a row like:
MrX Fishes Yes
MrX Smokes Yes
MrX IsEmployed No
MrY Fishes No
MrY Smokes No
MrY IsEmployed No
etc.
In a report you can group now on the activity and filter for Yes or No in the query as you please.

Just take my sample UNION query and replace the fieldnames and the tablename with yours.
Also make sure that the "1 as Origin" is changed into a meaningfull description like:

select membername, "Fishes" as Origin, FishInd from tblX
etc.

The SQL you can enter in the query editor. Just open a new query and don't select a table. Now top left a SQL button will appear and there you can enter the needed select/union statements.

Let me know when and where it goes wrong and publish the SQL with the message here.

Nic;o)
Dec 2 '06 #7

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

Similar topics

14
by: Jeff Boyer | last post by:
Hello everyone, I have recently developed a web application across my clients intranet. We used ASP with Interdev 6.0 and SQL server as the backend. They have now come to me asking me to...
4
by: joshsackett | last post by:
Hi all, I have 5 databases, each about 20GB in size. I need to copy the data to a new server for reporting purposes. Initially I wanted to setup transactional replication; however, the database...
4
by: DG | last post by:
Hi, Can anyone advise how to execute multiple statements in a single query batch. For example- update customers set customer_name = 'Smith' where customer_name = 'Smyth'; select * from...
0
by: MHenry | last post by:
Hi, I know virtually nothing about creating Macros in Access. I would appreciate some help in creating a Macro or Macros that automatically run(s) 14 Queries (three Make Table Queries, and 11...
2
by: nsh | last post by:
running access 2k; I have some stats (bowling) that I want to print in columns on a report. The top portion of the report will have a team-members name, and the bottom of the report will have...
3
by: jez123456 | last post by:
Hi My users, use ms access for querying and reporting on a backend database, however they need to replace ms access with a new reporting tool. I’m thinking of developing my own reporting...
8
by: Woody Splawn | last post by:
I am asking this question here because I asked this question in the Reporting Services Newsgroup and did not get an answer. Does anyone know if Reporting Services is intended to work in a...
1
by: Larry Dooley | last post by:
Here's my issue. We've decided to replace a very critical (without it the business would lose lots of money) departmental reporting system with a built from scratch system based on .NET. The key...
0
by: YellowFin Announcements | last post by:
Yellowfin Reporting Announces Release 3 OLAP Connectivity New Features Including OLAP-to-Relational Drill Through Provide Customers with One Complete Web BI Tool for OLAP Analysis Yellowfin,...
0
debasisdas
by: debasisdas | last post by:
REPORTING FUNCTIONS ALLOW THE EXECUTION OF VARIOUS AGGREGATE FUNCTIONS AGAINST A RESULT SET.UNLIKE WINDOWING FUNCTIONS THESE CAN'T SPECIFY LOCALISED WINDOWS AND THUS GENERATE THE SAME RESULT FOR EACH...
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?
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...
0
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,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.