Query with some data repeated

  • I have a Doctor table and child tales of Specialties and Offices.

    I want to put the specialties inline, but repeat the whole Doctor record for each office record. So my output will look like this:

    ID NAME OFFICE SPECIALTY1 SPECIALTY2

    DOC1 Dr Jones 123 Pine Gastro Internal Med

    DOC1 Dr Jones 432 Spruce Gastro Internal Med

    DOC2 Dr Smith 227 Hickory Cardio

    etc.

    What would the JOIN be assuming that all 3 tables have an ID field?

    Thanks,

    "What I lack in youth I make up for in immaturity!"
    Please visit my music site at http://woundedego.com

  • billross (10/16/2008)


    I have a Doctor table and child tales of Specialties and Offices.

    I want to put the specialties inline, but repeat the whole Doctor record for each office record. So my output will look like this:

    ID NAME OFFICE SPECIALTY1 SPECIALTY2

    DOC1 Dr Jones 123 Pine Gastro Internal Med

    DOC1 Dr Jones 432 Spruce Gastro Internal Med

    DOC2 Dr Smith 227 Hickory Cardio

    etc.

    What would the JOIN be assuming that all 3 tables have an ID field?

    Thanks,

    please provide me the table structure

    kshitij kumar
    kshitij@krayknot.com
    www.krayknot.com

  • I got this worked out.

    I drive the query off of the address file (so they list vertically) and for each record I do another select and, in a loop, make a string of the specialties.

    I didn't use it, but I did find this helpful site here:

    http://ryanfarley.com/blog/archive/2005/02/17/1712.aspx

    Have a great day.

    "What I lack in youth I make up for in immaturity!"
    Please visit my music site at http://woundedego.com

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply