Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

To bperry ( I have tried ur way but somthing is wrong)

Status
Not open for further replies.

Dado111

IS-IT--Management
Mar 18, 2002
8
AU
Hi,
Thanks for ur solutions i was trying to work on this one below but it is still not working. And to tell u the truth i haven't heard of the "CAST" before maybe it is replacment for some other word so if it is tell me what is it please check the code and tell me what u think
Thanks alot
Dado
N.B: if u need i can send u the Data base

SELECT ward.Ward_code,ward.Ward_name,
CAST (
(Select count(Ward_code) FROM Admission
WHERE admission.Ward_code = ward.Ward_code
AND admission.Discharge_date IS NULL
) AS numeric(3,2)) / bed_count *100 AS PerOcc

FROM Ward
INNER JOIN Admission
ON ward.Ward_code = admission.Ward_code
Group By ward.Ward_code, ward.ward_name, ward.Bed_count;

 
Dado111,

It would be better if you stayed in the same thread to continue the same subject. It difficult for other to know of the preceding discussion when you start a new thread. Will you post the previous thread number so others can review previous discussion.

You can copy the thread number found just below the subject near the top of the page to the clipboad. Paste it in a message just like I've done with the thread number of this thread.

thread220-237134 Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
>>....below but it is still not working.
I'm afraid you will have to tell me more than that. Does it run, but not return the proper data? Does it fail to run, and produces an error msg instead? If so, what msg? Was my assumption re: null discharge dates correct?
 
To <dado111>:
I should have mentioned that my suggestion should work in MS-SQL. It may not work in other RDMS, (but it might)

To Terry:
His previous thread# was thread 220-236428.
bp
 
dado111,

If you can send a database to someone, I'd guess you are working in Access. Is that the case? If so, CAST won't work.

If you post a question in this forum, you can expect an ANSI SQL answer. However, not all database suystems are compliant. If you want to be sure the answer fits your database, ask your questions in the correct forum. You can do a forum search at the top of the page. Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains &quot;Suggestions for Getting Quick and Appropriate Answers&quot; to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top