Jump to content

SQL possibly JOIN problem


metrostars

Recommended Posts

Hi.

 

I 2 tables like this.

 

users

 

id                    1                  2

firstname          Bob              Jimmy

lastname        Hendrix          Marley

...

 

and

 

bookings

 

id                    1                      2

userid              2                      2

date          2008-08-12        2008-08-15

...

 

What I would like is to select a number of fields from users and also the id from bookings that links bookings.userid to users.id.

 

So:

 

1                      users.id

Jimmy                firstname

Marley              lastname

2                    bookings.id

 

There must only be 1 id returned for bookings.id per user.

 

I've tried a number of strawberry mthods but i can't the right one.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/95052-sql-possibly-join-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.