Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2003
    Posts
    5

    Unanswered: SQL statement i can't figure out

    If anyone can easily do this I'd appreciate it. I'm scratching my head and burning time.

    I have 4 tables all using Uinique ID's as primary key

    Profile,PofileDetail, Vendorparts & Vendor.

    I want to list all detail records that have a vendorpart where name like '%NLA' and display vendor name

    Profile.UID
    Profile.Number

    ProfileDetail.UID
    ProfileDetail.ProfileNumber
    ProfileDetail.VenPartID

    VendorParts.UID
    VendorParts.PartName

    Vendor.UID
    Vendor.Name

    Profile.Number VendorPart.PartName Vendor.Name
    -----------------------------------------------------------------

    I've come close to doing it but when I add the vendor.Name to the mix, all the vendor.PartName fields display the same PartName.
    Thanks
    Last edited by TPnTX; 04-01-03 at 09:54.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i'm not sure how your tables are related
    Code:
    select ProfileDetail.ProfileNumber
         , VendorParts.PartName
         , Vendor.Name
      from ProfileDetail
    inner
      join VendorParts
        on ProfileDetail.VenPartID = VendorParts.UID
    inner
      join Vendor
        on ??????????
    rudy
    http://r937.com/

  3. #3
    Join Date
    Mar 2003
    Posts
    5

    relates

    select ProfileDetail.ProfileNumber
    , VendorParts.PartName
    , Vendor.Name
    from ProfileDetail
    inner
    join VendorParts
    on ProfileDetail.VenPartID = VendorParts.UID
    inner
    join Vendor
    on ??????????


    You thats exactly what I've done except I didn't use the Inner/join/on
    It's works fine doing the vendorpart join.

    Oh I left one field out in the example. The VendorPart.VendorID field points to Vendor.UID. Thats where I have trouble trying to join it similar to the Detail-to-VendorPart join.

    I'm trying you example now adding:
    Inner
    Join
    on Vendor.UID = VendorParts.VendorID

  4. #4
    Join Date
    Mar 2003
    Posts
    5

    Done

    That did it!

    I see to things that gave me trouble.

    1 I wasn't using the join/inner/on. Actually I tried.

    2
    on ProfileDetail.VenPartID = VendorParts.UID

    I would have thought the this to be
    VendorParts.UID = ProfileDetail.VenPartID


    Thanks though it works now.

Posting Permissions

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