Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2007
    Posts
    2

    Unanswered: Query Three Tables - Please Help

    Hi

    I need to be able pull certain data from our database. I need to find all stockitems (itemid column) that are a T item (binname column) and the memo to be created before the 01/02/2007 (timeanddatecreated column)

    To get the data I need - I need to query three tables.

    Stockitem - This has the column "itemid"
    Stockitemmemo - This has the column "itemid" and "timeanddatecreated"
    Binitem - This has the column "itemid" and "binname"

    My results must be based on the following criteria......

    All the itemid's have a 'T' in binitem.binname and the memo must have been created before 01/02/2007.

    I do have two questions based on the above....

    1. Does it make sense what I need?
    2. Is it possible



    Any help would be gratefully received.

    Thanks

    Simba

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    OK, help us out.

    Read the hint sticky at the top of the forum and post what it asks for
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Jan 2003
    Location
    Nottinghamshire, UK
    Posts
    364
    Possibly a straight Forward

    Code:
    
    SELECT Stockitem.itemid
    ,Stockitemmemo.Memo
    ,Binitem.binname
    FROM Stockitem
    INNER JOIN Stockitemmemo ON
    Stockitem.itemid = Stockitemmemo.itemid
    INNER JOIN Binitem ON
    Stockitem.itemid = Binitem.itemid
    WHERE Binitem.binname LIKE'%T%'
    AND Stockitemmemo.timeanddatecreated <'01/02/2007'
    
    Everyones gotta start somewhere

    Beware If there is NO matching record in either Stockitemmemo or Binitem table then the Stockitem row will NOT be returned - You would need to Consider a LEFT Join to deal with that.

    GW

    GW
    "Everything should be made as simple as possible, but not simpler." - Albert Einstein
    "Everything should be made as complex as possible, so I look Cleverer." - Application Developer

  4. #4
    Join Date
    Jul 2007
    Posts
    2

    Cool

    Your an absolute legend thanks very much! Appreciate your help.

    Thanks again.

  5. #5
    Join Date
    Jan 2003
    Location
    Nottinghamshire, UK
    Posts
    364
    You're Welcome
    "Everything should be made as simple as possible, but not simpler." - Albert Einstein
    "Everything should be made as complex as possible, so I look Cleverer." - Application Developer

  6. #6
    Join Date
    Feb 2004
    Location
    Burbank & Santa Cruz de la Sierra
    Posts
    3,716
    What's in an absolut legend anyway? Sounds interesting, and my banana Kamikaze's are starting to get me in trouble, so I need a change.
    aka "Paul"
    Non est ei similis.

    I just read "100 Things To Do Before You Die". I was surprised that "Yell for help!!" wasn't one of them

  7. #7
    Join Date
    Jan 2003
    Location
    Nottinghamshire, UK
    Posts
    364
    LOL Tall
    What's in an absolut legend anyway?
    in the UK we call it "Horses for courses"

    I'll gladly leave the difficult one's for the u true legends.

    Not sure what a banana Kamikaze is but sounds like you need a TallBoy http://www.dbforums.com/showpost.php...9&postcount=30 - LOL

    GW
    Last edited by GWilliy; 08-02-07 at 06:26.
    "Everything should be made as simple as possible, but not simpler." - Albert Einstein
    "Everything should be made as complex as possible, so I look Cleverer." - Application Developer

Posting Permissions

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