MySQL joining - a tricky problem from a newby

  • Hi,

    I'm not even sure whether this is possible. I've three tables, one containing a location ID, and a location name. The second table is a users table, which contains the kind of information you'd expect, i.e. name address etc. The third table is a transactions table containing rows describing transactions which can be described in the following way.

    A client requests to be driven somewhere. A driver volunteers for this job. The table contains the date of the trip, plus a user id for the client a user id for the place/location, and a user id for the driver.

    Drivers and clients are both in the users table.

    Ive set up foreign keys in the transactions table for the place id, and for the user id.

    I now need to select and display the information, i.e.

    Client name, driver name, place name. I'm not completely ignorant on this subject, and have used MySQL in the past, but not in this way.

    1.Is this possible, given that the users file contains both clients and drivers. If not, just break the news, and I'll need to find another way.

    2.If it is possible, can anyone give guidance as to the correct syntax for such a MySQL statement. There are other columns I need, but keeping it simple, how do I get:

    Client name, Place name, and driver name. That should get me started.

    Thanks.

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply