Page 3 of 3 First 123
  • Jump to page:
    #31
  1. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)
  2. #32
  3. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    speaking sql


    thanks so much for putting such a "to the point" informative series of tutorials together. i am trying to learn sql and almost every site i've visited assumes that you know "so and so" to get past some sticking points that are simple if you know about them and frustrating if you don't. you have done a great job in finding useful items for everyday work and explained and illustrated them in a straight forward manner. thanks again. you've been a big help to me. keep them coming
  4. #33
  5. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: More Join Options?


    Name: Matthew Nuzum
    Subject: More Join Options?
    Date: 01-22-2001 07:16:00 MST (GMT -7)
    I'm new to using joins, and have a question that expands on this example:

    SELECT fname, lname, title FROM members, videos, status WHERE
    status.member_id = members.member_id AND status.video_id = videos.video_id;

    The example shows all the records that have related data in each of the three tables.

    Let's modify the example to say that you wanted a complete inventory listing plus any extra info such as whom it was checked out to if it's checked out.

    I've played with the sytax and I've found that I have to use the words LEFT JOIN to get it to do what I want. i don't know what LEFT JOIN means, and I don't know how to use two or more in the same query.

    Here's my exact query (that doesn't work):

    SELECT tbUsers.user,
    tbUsers.password,
    tbUsers.account,
    tbAccounts.level,
    tbAccounts.term,
    tbAccounts.paid_through,
    coupon.uid,
    tbDirectory.id
    FROM tbUsers
    LEFT JOIN tbAccounts ON (tbUsers.account = tbAccounts.id)
    LEFT JOIN tbDirectory ON (tbUsers.account = tbDirectory.account)
    LEFT JOIN coupon ON (tbUsers.account = coupon.account)

    Keep in mind I want to show all records that appear in the table tbUsers with any related information in the tables tbAccounts, tbDirectory and Coupon.

    If I omit the last two LEFT JOIN statements and some of the field names, the query works. No matter what I try, commas, ANDs ORs I can't get it to work with more than one LEFT JOIN.

    I tried to duplicate my efforts in MS Access using it's query tool and it produces a query that uses RIGHT JOIN sytax. Unfortuntately, this query doesn't work in MySQL where I need it to.

    This is by far the best tutorial I've read yet on general query syntax, thanks. If you can help, please let me know.

    Matt
  6. #34
  7. No Profile Picture
    Ducani
    Guest
    Devshed Newbie (0 - 499 posts)

    Speaking SQL (part 2)


    Speaking SQL \(part 2\)

    After learning how to insert and edit data in a database, the second part of our SQL tutorial takes an in-depth look at the SELECT query,and explains how to use joins, sub-queries and built-in functions to focus in on the data you need.

    Please discuss this article in this thread. You can read the article here .
Page 3 of 3 First 123
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo