Hi List, I have a view that works fine as-is, but I want to make it dynamic, replacing a few values with variables.
SELECT > service, > sum( num ) AS num, > round( ( sum( num ) * 100.0 ) /( > SELECT sum( num ) > FROM* [$table_prefix]*_wms__getmap > WHERE time_date > (SELECT datetime(max(time_date), > *[$date_string]* ) FROM *[$table_prefix]*_all__request_type) > ), 2 ) AS percent > FROM *[$table_prefix]*_all_wms__getmap > WHERE time_date > (SELECT datetime(max(time_date), *[$date_string]* ) > FROM *[$table_prefix]*_all__request_type) > GROUP BY service > ORDER BY sum( num ) DESC > There are two variables: *$date_string* which will contain a string such as "-7 days" or "-1 month". and *$table_prefix* which will be a number indicating which table set to look in. I know SQLite can't do variables (for example http://sqlite.1065341.n5.nabble.com/Using-local-variables-through-sqlite-td21270.html) but does anyone have any suggestions for how this can be done? I don't want to have to create tons of extra views if I don't have to. Thanks, Jonathan -- This transmission is intended for the named addressee(s) only and may contain confidential, sensitive or personal information and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users