If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How to display composite of fields from multiple records alphabetically ...?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-13-07, 08:42
hconnor hconnor is offline
Registered User
 
Join Date: Feb 2007
Posts: 34
How to display composite of fields from multiple records alphabetically ...?

Hi,
Here's my goal: to display multiple different fields from multiple records all together, alphabetically. Currently, I have fields that can be summarized as this.

Physician_ID
PracticeArea1
PracticeArea2
PracticeArea3

My goal is to build a page for the physician office so that I can display all the physician's practice areas together and alphabetically. The office is already linked to the physician records. The areas aren't entered alphabetically to start with, but by importance. I thought that one choice would be to move the practice areas off to to a separate table and then display the results with ORDER by ASC. But ORDER by will want to choose a single column which doesn't seem to help here.
PracticeArea_ID
PracticeArea1
PracticeArea2
PracticeArea3

Of course if ALL of the records were in one column that would work. Maybe concat would help here? Suggestions please.
Reply With Quote
  #2 (permalink)  
Old 08-13-07, 09:18
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
The good news is - it can be done.
The bad news is that you need to go back to the drawing board on your design, my friend!
Quote:
Originally Posted by hconnor
Physician_ID
PracticeArea1
PracticeArea2
PracticeArea3
Is that really your design?
Note to Rudy: Rudy, I have misplaced the link to the article published on your site regarding normalization... Please post it (again)!

EDIT: Thank you sir
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 08-13-07, 09:20
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 08-13-07, 12:07
hconnor hconnor is offline
Registered User
 
Join Date: Feb 2007
Posts: 34
well, part of the problem is that rather than choosing from a list of practice areas, each person is allowed to decide on a special practice area. this has been confusing; still, because of the repetitive nature of that field, these probably do need to go into a separate table and get a foreign key to the physician. but if each physician is linked to a separate field with practice areas, and we are looking at a group of physicians, how can all of those practice areas be made alphabetical?
Reply With Quote
  #5 (permalink)  
Old 08-13-07, 12:36
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by hconnor
... how can all of those practice areas be made alphabetical?
i did not really follow the preamble to this question, but i know the answer -- with the ORDER BY clause of the SELECT query which retrieves the information you want

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On