Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2004
    Posts
    20

    Unanswered:

    Hey everyone, hope your weekend was relaxing.

    I need a to make a query that does the following, but first here are the objects w/ their relevant column names

    My_Query
    Current_ID

    Table: Key

    ID
    Name


    What i need to do is take the first Current_ID in My_Query, and use it to get the corresponding Name value from Key

    If you have any questions as to what im trying to do or if this is not clear please let me know.

    Thanks
    Doc
    Last edited by doctor; 07-26-04 at 15:56.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    In SQL Syntax, you want something like:
    Code:
    SELECT q.*, k.name
       FROM myQuery AS q
       JOIN key AS k
          ON (k.ID = q.Current_ID)
    -PatP

  3. #3
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Looks simple, is this part of your HOMEWORK?

    You should try coding the solution yourself, that's the idea of homework.

    Also check this out:

    http://www.catb.org/~esr/faqs/smart-questions.html

    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  4. #4
    Join Date
    Jun 2004
    Posts
    20
    LKBrwn, No this is not part of my HOMEWORK (who has homework in the summer time anyway?) its just somthing im trying to do. Im trying to learn sql but dont really have any books or really good web references(just so-so) ones. So once in a while if im trying to do somthing i get stuck on i pop up on the boards. I wasnt looking for a complete solution, the hint provided was good enough to get me started, if i get lost ill bb. Instead of pointing me to a link on "smart question" how bout you point me to a link that has a good SQL rundown? Cause remember there are no stupid questions, only stupid people

  5. #5
    Join Date
    Jun 2004
    Posts
    20
    Ok, got my resultant list of data, last question is this: When it joins the data it auto orders the list via number. And for my purposes I need it in the order they appear in "my query". That i am really not sure how to do, my original post was quite trivial, sorry for posting a stupid question with a mislabelled subject.

  6. #6
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Remove the ORDER BY from the existing query, and put that ORDER BY into the new SELECT statement that does the JOIN to the key table.

    -PatP

  7. #7
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

  8. #8
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Quote Originally Posted by doctor
    Cause remember there are no stupid questions, only stupid people
    WE never intend to call anybody stupid for asking questions, in fact the purpose of all forum participants is to help/teach others how to solve a problem, "ask a good question, receive a good answer".

    Also, when you post the code you are working on we know you have at least tried. When learning (in class or otherwise) it helps you most when you try to solve it by yourself and if you get stuck, then request some help.

    Everybody here learns from each other, sometimes just looking at the solutions posted.

    I wish you luck with your learning experience!
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  9. #9
    Join Date
    Jun 2004
    Posts
    20
    Thank you very much, I appreciate it. I know what you mean bout the stupid people part i was just poking some fun at myself :-P

    Thanks again
    Doc

Posting Permissions

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