Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2007
    Posts
    34

    Unanswered: 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.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    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
    Home | Blog

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    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?

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •