Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - need sql statement
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

need sql statement

 Post Reply Post Reply Page  12>
Author
cuedog View Drop Down
Groupie
Groupie
Avatar

Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote cuedog Quote  Post ReplyReply Direct Link To This Post Topic: need sql statement
    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?
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 07 December 2003 at 2:55am

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

try going to the link above

that will be EVERYFIN you need

S2H.co.uk - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
cuedog View Drop Down
Groupie
Groupie
Avatar

Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote cuedog Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 07 December 2003 at 12:28pm

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

Back to Top
aalavar View Drop Down
Groupie
Groupie


Joined: 08 December 2003
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote aalavar Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
cuedog View Drop Down
Groupie
Groupie
Avatar

Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote cuedog Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 09 December 2003 at 12:53am
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 09 December 2003 at 1:53pm
man... at least make him work to find what he needs
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.