Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old April 30th, 2002, 07:36 PM
wargod1999 wargod1999 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: new york, ny, US
Posts: 4 wargod1999 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to wargod1999
Need help with a query

I'm trying to make a query using SQL that specifies the number of test takers in a specific date range, grouped by race, and grouped by age but in groups of 10(ex. age 30-40, 41-50, etc...). It should look something like this...
|30-40|41-50|51-60|61-70|71+|
white| | | | | |
black| | | | | |
asian| | | | | |



sorry for the horrible drawing, I don't know how to explain it any better. Please contact me ASAP because I'm running into my deadline!!!! HELP!!!!

Reply With Quote
  #2  
Old April 30th, 2002, 07:38 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 12 m 16 sec
Reputation Power: 7
RE: Need help with a query

I don't believe with ANSI standard SQL that you are going to be able to achieve output like you are looking for. What DBMS are you using? It is possible that you might be able to use specific features of it (like stored procedures in MSSQL) to obtain that output....


Reply With Quote
  #3  
Old April 30th, 2002, 07:44 PM
wargod1999 wargod1999 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: new york, ny, US
Posts: 4 wargod1999 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to wargod1999
RE: Need help with a query

I'm using MS Access 2002. do you know if this can be done with this program? If I cant use SQL, is it possible to achieve this with VBA?

Reply With Quote
  #4  
Old April 30th, 2002, 07:48 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 12 m 16 sec
Reputation Power: 7
RE: Need help with a query

Well, I can tell you that you can definately create a report in Access that will give you what you want. I haven't messed with Access2002, but I can tell you that it can be done with Access97. Look into the reporting features of the program. You should be able to set labels for your age ranges, and labels for your race. Then do queries such as:

SELECT count(*) FROM table WHERE age <= 40 AND age >=30 AND race='white'

to fill in the values....


Reply With Quote
  #5  
Old April 30th, 2002, 08:15 PM
wargod1999 wargod1999 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: new york, ny, US
Posts: 4 wargod1999 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to wargod1999
RE: Need help with a query

sorry, but for some reason Its returning zero.

Reply With Quote
  #6  
Old April 30th, 2002, 08:55 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: Need help with a query

Well, you will need to fine tune the query for your particular table and such. That was just an example...

Reply With Quote
  #7  
Old May 6th, 2002, 04:23 PM
wargod1999 wargod1999 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: new york, ny, US
Posts: 4 wargod1999 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to wargod1999
RE: Need help with a query

Ok, I used this code for every field in my table I made in a report so for this example, this field is under Age 30-40, next to Asian.

SELECT Count(survey.[age:]) AS age3040
FROM Survey
WHERE Survey.[Age:]>=30 and Survey.[age:]<=40 And (((Survey.[Date:]) Between forms!daterange3!startdate3 And forms!daterange3!enddate3)) and Survey.[Which of these categories describes you?]="Asian";

This works acctually! the only problem is is that it only can handle 6 races (30 fields). When I try to add another race (which is five fields more), and try to point the field to the query it says "query too complex". What I did was take every query for each field and put that into another query and set that as the record source of the report. so when I add another five queries to the query master, it says too complex. I also tryed grouping the queries together by race so the query master would only have 5 queries, but it doesn't work. I hope I'm not confusing you, sorry. based on this code, do you have any ideas that would be able to strip it so it wouldn't be so complex (even though it doesn't look so complex to me).

Reply With Quote
  #8  
Old July 12th, 2002, 09:25 PM
jediknight219 jediknight219 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 jediknight219 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Need help with a query

I know this question's been sitting here for a while, but I saw the answer in a devshed.com article once.

Check out:
http://www.devshed.com/Server_Side/MySQL/MySQLWiz/page1.html

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Need help with a query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek