I agree with Troy here…

 

To ensure that you are getting the rows 1 thru 10 of the results of the join.

Place the join in a view

And then use the view where count between 1 and 10

 

Ben Johansen - http://www.pcforge.com
Authorized Witango & MDaemon Reseller
Available for Witango Developement

-----Original Message-----
From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Troy Sosamon
Sent: Monday, October 13, 2003 3:56 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: count with multiple tables

 

I think this would give you unpredictable results.

I think you might be looking for a group by and a having clause.

 

select table1.masterId, count (*) from table1 left join table2 on (....)

group by table1.masterID having count (*) <= 10

 

This would give you a list of masterid with 10 or fewer rows in table2.

 

Troy 

 

 

 -----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Alan Wolfe
Sent: Monday, October 13, 2003 3:54 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - count with multiple tables

hello i was wondering about using count in selects that involve multiple tables.

 

if i have something like this:

 

select * from

table1 left join table2

on (clause here)

and count > 0

and count <= 10

 

which table does it get the count from?

 

is it table1, table2 or is it the number of results that it returns?

 

TIA,

Alan

Reply via email to