Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Ordering 2 recordsets
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Ordering 2 recordsets

 Post Reply Post Reply
Author
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Topic: Ordering 2 recordsets
    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
Soft 4 web
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2004 at 9:27am
I would use one table with a flag that noted doc or pharm.
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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.



Edited by dpyers

Lead me not into temptation... I know the short cut, follow me.
Back to Top
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post 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
Soft 4 web
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

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.