[ic] sort option PS Thanks Racke

Paul Jordan interchange-users@interchange.redhat.com
Sun May 26 19:36:01 2002


>
> I suggest to revise your database structure. You can store the
> date as seconds
> since epoch or in a SQL native format. In the former case use the
> [tag time]
> function, in the latter use [query sql=""] and the functions provided
> by SQL database for converting dates/times.
>
> Ciao
>         Racke

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?


TIA

Paul

BTW- I am new to perl, so it is OK to make fun of my calc.