Sam Roberts wrote:
> 
> I'm having the problem with DBD:CSV, wherein things
> like DISTINCT and SORT don't work:

I'll send you a development version of SQL::Statement that will fix
that.

> "select date from svv_bug_count"

DBD::CSV lets you get away with that, but you really shoudn't name your
column "date" since that is a SQL reserved word.

> p.s. Totally offtopic: I'm an SQL newbie, do you happen to know an SQL
> query that will get me the latest date?

This should do it (notice the use of selectrow_array() to get only one
row and the use of DESC = descending order in the ORDER BY clause to put
the latest date first):

  my $latest_date = $dbh->selectrow_array(qq~
      SELECT date FROM svv_bug_count ORDER BY b_date DESC
  ~);

 
> p.p.s. Is there any kind of special date handling in SQL::Statement?

Not currently, but I've added other kinds of data type recognition to it
and dates will eventually be a recognized data type for columns.

> I've chosen "yyyy/mm/dd hh:mm" (with 24 hour hh) because it a textual
> sort is equivalent to a date sort

Right, that's the best you can do currently.

-- 
Jeff

Reply via email to