Jump to content

Recommended Posts

Hi Guys,

 

just a small table example of what im trying to do

sale_id  buyer_id

1          2

1          2

1          4

2          3

3          5

 

Im trying to get all the data out of the table where the sale_id has more than 1 buyer_id so basically im trying to just get the first 2 records back

 

i though it would be something like the following

 

select * from sale where (select count(buyer_id) > 1) // so where the sale_id has more than 1 buyer_id on it

 

but this does not work any help please :)

 

Link to comment
https://forums.phpfreaks.com/topic/151406-solved-sql-query-help/
Share on other sites

Sure, if I understood your question correctly it should work.

 

I'm a little confused about this:

 

Im trying to get all the data out of the table where the sale_id has more than 1 buyer_id so basically im trying to just get the first 2 records back

 

Only sale_id 1 has more than 1 buyer, so why would you expect 2 records back?

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.