Print Page | Close Window

Ordering 2 recordsets

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=10027
Printed Date: 31 March 2026 at 4:19pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Ordering 2 recordsets
Posted By: zaboss
Subject: Ordering 2 recordsets
Date Posted: 17 April 2004 at 3:57am

Here it is the table structure:

tblVisitsDoctors
ID (autonumbered)
strData (Date)
strOra (Time)
strDoctor (txt)
strProdusPrezentat (txt)
strProdusPrezentat2 (txt)
strInput (txt)
strInput2 (Memo)
strObservatii (Memo)
strNote (Memo)
strFeedback (memo)

tblVisitsPharma
ID (autonumbered)
strData (Date)
strOra (Time)
strPharma (txt)
strVorbitCu (txt)
strProdusPrezentat (txt)
strProdusPrezentat2 (txt)
strInput (txt)
strInput2 (Memo)
strObservatii (Memo)
strNote (Memo)
strFeedback (memo)

As you can see, they are almost identical. VisitPharma has 1 field more, but it does not matter. What I need is to display all the visits in the same day, regardles where they were (doctor or pharmacist), ordered by the hour of the visit (strOra). In this common report, there only need to be:
| Person visted (strDoctor or strPharma) | What is visited (Write Doctor if is a doctor or Pharma if it's a pharmacist) | Time of the visit (strOra) | Reason (strNote) | Feedbak (strFeedback) | Full details (a link to display fiull report about the visit) .

Database is MySQL.



-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web



Replies:
Posted By: ljamal
Date Posted: 17 April 2004 at 9:27am
I would use one table with a flag that noted doc or pharm.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: dpyers
Date Posted: 17 April 2004 at 11:19am

If you're dealing with a known universe of Doctors/Pharma's,...

I'd put them in a separate "Provider" table with a autonum key in it that is referenced in the combined detail table. Include the Type Field in the new table.

Ensures that spelling is consistant and that only approved Docs/Pharmas are entered. If at some point you need to add addresses or phone numbers, do it to the Provider table instead of updating all the detail records.

The rule of thumb for most data normalization is that if the same data is going to be used by many detail records, it should be in a separate table.



-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: zaboss
Date Posted: 17 April 2004 at 11:54am

A simple UNION statement solved the problem... I don't know why I was trying to use the join (which mySQL does not support at the moment).

dpyers, there are two special tables dedicated to both the doctors (around 35 fields) and pharmacies (37) with all the information needed. And most of them are quite different, so a single table for both would only be a waste of db space since invariably would have many blanks. I'dd rather call them upon needs in other table (strDoctor is in fact a "join" of 2 fields from the tblDoctors, strName & strSurname, while the strPharma is only made out of the strPharma in the tblPharmacy). This way there would not be a problem of misspelling data.



-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web


Posted By: dpyers
Date Posted: 17 April 2004 at 12:18pm
Ah, I see. Makes sense to me. I had thought that the two tables in the OP were stand-alone tables.

-------------

Lead me not into temptation... I know the short cut, follow me.



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