Turning the pseudo code into a bash script produced the desired output:
for i in $(sqlite3 team.db 'select distinct div from teams ' ) ; do
sqlite3 -separator $'\t' team.db '
select div, team, wins
from teams
where div="'$i'"
order by wins+0 desc
limit 3 ;'
done
I am still curious to know if there is a purely SQL way to do the same.
Regards,
- Robert
On Thu, Jan 8, 2009 at 12:06 AM, Robert Citek <[email protected]> wrote:
> In pseudocode, I want to do something similar to this:
>
> for $i in (select div from teams) {
> select div, team, wins from teams where div=$i order by wins desc limit 3 ;
> }
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users