SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard dethfire's Avatar
    Join Date
    Aug 2000
    Posts
    2,477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL statement help!

    This one is way over my beginner head. Here are my tables:

    - tblCredit
    CreditID
    CreditNumber

    - tblCreditItem
    CreditID
    ProductID

    - tblProduct
    ProductID


    I need data from tblcredititem and tblproduct. I have a creditnumber.
    Free Science Homework Help
    http://www.physicsforums.com

  2. #2
    SitePoint Wizard Goof's Avatar
    Join Date
    Feb 2001
    Location
    Pittsburgh, PA
    Posts
    1,154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: SQL statement help!

    Would this work?

    Code:
    SELECT tblCreditItem.CreditID, tblProduct.ProductID FROM tblCreditItem, tblProduct, tblCredit WHERE tblCredit.CreditID = tblCreditItem.CreditID AND tblCreditItem.ProductID = tblProduct.ProductID AND tblCredit.CreditNumber = 'some value';
    Kinda like a double join - odd.

    Hope that helps,
    Goof
    Nathan Rutman
    A slightly offbeat creative.

  3. #3
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    Alkmaar, Netherlands
    Posts
    710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    SELECT FROM tblCredit tc
    LEFT JOIN tblCreditItem tci ON tc
    .CreditID tci.CreditID
    LEFT JOIN tblProduct tp ON tp
    .ProductID tci.ProductID
    WHERE tc
    .CreditNumber=someNumber 


Bookmarks

Posting Permissions

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