[ic] sort option PS Thanks Racke

Kevin Walsh interchange-users@interchange.redhat.com
Sun May 26 20:53:01 2002


> Thanks to the advice of Racke, I have utilized DATE format in my mysql
> database, and have since converted the catalog to utilize this one compact
> column :)
> 
> However, I am having one last issue in the conversion. This query finds all
> trips in a given year - no problem. I have been trying to figure out how to
> do an [sql-change] on the just the month porion of the date: yyyy-mm-dd
> 
>     [query
>         type=list
>         st=sql
>         sql="
>             SELECT  *
>             FROM    products
>             WHERE   date LIKE '[if !cgi mv_arg]2002[else][cgi
> mv_arg][/else][/if]%'
>             AND     searched BETWEEN '1' AND '2'
>             ORDER BY date
>         "]
> 
> [sql-change 1][condition]
> 
> [calc]
> my $date = q{[sql-param date]};
> my $month = substr($date,5,2);
> return $month;
> [/calc]
> 
> [/condition]
> 
> ......code...... [/sql-change 1]
> 
> This calc, and many other hacks, have not been successful. Any hints guys?
> 
Surround your [sql-*] tag set with [list] ... [/list], as you have
specified "type=list" mode.

You should also change your [calc] to [sql-calc] and the same for the
calc's end-tag.

One other minor thing.  You should try to select the columns you need
rather than "select *".  Just a good habit to get in to.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/