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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.