Re: [SQL] Displaying first, last, count columns

2006-06-21 Thread Frank Bax
At 10:55 AM 6/21/06, Worky Workerson wrote: I'm having a bit of a brain freeze and can't seem to come up with decent SQL for the following problem: I have a table "t" of the form "time_occurred TIMESTAMP, prog_data VARCHAR" and would like to create a query that outputs something of the form "fi

Re: [SQL] Displaying first, last, count columns

2006-06-21 Thread Aaron Bono
I would suggest:selectmax(time_occurred) AS last_seen,min(time_occurred) AS first_seen,count(*),prog_datafrom tgroup by prog_dataI would also suggest you use inner joins rather than put all your tables in the from and join in the where clause.  It is much easier to read and understand what you are

[SQL] Displaying first, last, count columns

2006-06-21 Thread Worky Workerson
I'm having a bit of a brain freeze and can't seem to come up with decent SQL for the following problem: I have a table "t" of the form "time_occurred TIMESTAMP, prog_data VARCHAR" and would like to create a query that outputs something of the form "first_seen, last_seen, count, prog_data". I hav