Jump to content

[SOLVED] sql query help


jake2891

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?

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.