Re: How do I ... SQL question

2005-01-18 Thread Harald Fuchs
In article [EMAIL PROTECTED], [EMAIL PROTECTED] writes: SELECT DISTINCT place FROM a ; place --- south west east Note that the place north does not appear in the last result because north was only visited by bob in 2005 and kim in 2004, records which are not included in

Re: How do I ... SQL question

2005-01-18 Thread SGreen
[EMAIL PROTECTED] wrote on 01/17/2005 06:45:22 PM: Hi there: I have a How do I... SQL question regarding selecting distinct values from a field not included in an aggregated query when LIMIT is in effect, illustrated by the following example: Table a contains the names of individuals

Re: How do I ... SQL question

2005-01-18 Thread Bob
Return only four rows beginning at second row: SELECT count(*) AS count, name, year FROM a GROUP BY name, year ORDER BY count DESC, name ASC LIMIT 4 OFFSET 1; count name year --- -- -- 3 joe2004 s,e,e 2 bob2003 w,e 2 kim

How do I ... SQL question

2005-01-17 Thread zeus
Hi there: I have a How do I... SQL question regarding selecting distinct values from a field not included in an aggregated query when LIMIT is in effect, illustrated by the following example: Table a contains the names of individuals, the places they have visited and the year in which they were

Re: How do I ... SQL question

2005-01-17 Thread Scott Baker
Can't you do: SELECT count(*) AS count, name, year FROM a WHERE place IN ('south','west','east') GROUP BY name, year ORDER BY count DESC, name ASC LIMIT 4 OFFSET 1; [EMAIL PROTECTED] wrote: Hi there: I have a How do I... SQL question regarding selecting distinct values from a field