Print Page | Close Window

need sql statement

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=7912
Printed Date: 30 March 2026 at 7:27am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: need sql statement
Posted By: cuedog
Subject: need sql statement
Date Posted: 07 December 2003 at 1:57am
I have a table called patient which holds patient information like their name and address. I have another called [patient status] which holds diagnosis, patient id, and diet. And another called admission which holds the patient id, and date_admit. I am using MS Access 2000. I need to make 2 reports.

1. Breakdown by numbers of patients classified by type of diets.

2. Display a list of all patients that were treated for the same diagnosid during the past 30 days.

Can anyone help?

-------------
http://www.512ryders.com - 512 Ryders



Replies:
Posted By: Scotty32
Date Posted: 07 December 2003 at 2:55am

http://www.webwiz.net/asp/tutorials/default.asp - http://www.webwiz.net/asp/tutorials/default.asp

try going to the link above

that will be EVERYFIN you need



-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: cuedog
Date Posted: 07 December 2003 at 11:41am
Thanks for the reply, I have viewed the tutorials but in my case I just don't know how to form the sql statement with the data I have, this is what I need help with.

-------------
http://www.512ryders.com - 512 Ryders


Posted By: pmormr
Date Posted: 07 December 2003 at 12:28pm

get a tutorial on sql... w3schools.com has a good one



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: aalavar
Date Posted: 08 December 2003 at 8:22am

Originally posted by cuedog cuedog wrote:

1. Breakdown by numbers of patients classified by type of diets.

2. Display a list of all patients that were treated for the same diagnosid during the past 30 days.

Well if you don't need the breakdown by date (ie the numbers from the last 30 days), it's not that hard.  I'll show you how to do it without the date, and if you need the date, it should not be to hard to add...

SELECT count(patient_id), diet
FROM patient_status
GROUP BY diet;

Basically just get the count of patient_id's, and group by their diets.  That will give you all of the patients for that diet, but there is no date restriction, it will go all the way back to the beginning of your data.



Posted By: cuedog
Date Posted: 09 December 2003 at 12:10am
Thanks aalavar you actually gave me the answer I was looking for. I found the answer earlier though. I appreciate your reply.

-------------
http://www.512ryders.com - 512 Ryders


Posted By: Mart
Date Posted: 09 December 2003 at 12:53am
http://www.w3schools.com/sql - http://www.w3schools.com/sql


Posted By: pmormr
Date Posted: 09 December 2003 at 1:53pm
man... at least make him work to find what he needs

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: aalavar
Date Posted: 09 December 2003 at 6:31pm

*shrugs*, the best way I learned was to look at other statements, not necissarily through tutorials.  I'm a firm believer in finding what you need, but sometimes what you need is a quick response, not a redirection to someplace that will leave you with more questions.

To each his own I guess...




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net