2012/1/3 guiz <[email protected]>:
> Hi all, if I have a table like
> CREATE TABLE [a] (
> [ID] INTEGER NOT NULL,
> [prdtype] VARCHAR(35) NOT NULL
> )
>
> and data already inserted as
>
> insert into a (ID, prdtype) values (1, '15');
> insert into a (ID, prdtype) values (2, '15|10|27|3');
> insert into a (ID, prdtype) values (3, '8|6|22');
>
> and I'd like to update table 'a' to achieve sorted result in prdtype as ...
> Rick
PHP experiment:
<?php
function phpsort($str) {
$a=explode('|',$str);
asort($a);
return implode('|',$a);
}
$db=new PDO('sqlite:test.db');
$db->sqliteCreateFunction('usort','phpsort');
$db->query('UPDATE a SET prdtype=usort(prdtype);');
?>
--
Kit
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users