"Andrew Drummond" <[EMAIL PROTECTED]>
wrote in message
news:[EMAIL PROTECTED]
> I am trying to write an sqlite select statement that performs the
> below pseudo code, but am getting nowhere.  Any help we be very
> appreciated.
>
> PSEUDO CODE
>
> for each element1 in (select address.* from numbers,address where
> numbers.number = "12345678"  and numbers.address_id =
> address.address_id) {
>    for each element2 in (select numbers.* from numbers where
> address_id = element1.address_id LIMIT 20)
>    return element1.* , elemen2.number
> }

select a.*, n.number
from address a join numbers n on (a.address_id=n.address_id)
where a.address_id in (select address_id from numbers where 
number='12345678') and
    n.rowid in (select rowid from numbers nn where 
a.address_id=nn.address_id limit 20)

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to