开发者

sqlite group_concat without group_concat

开发者 https://www.devze.com 2023-02-27 08:56 出处:网络
I\'m in a bit of a bind: I\'m limited to using sqlite 3.4.2 w/ php5-sqlite (ubuntu hardy) and I\'ve got some complex queries that were written using the group_concat() function.

I'm in a bit of a bind: I'm limited to using sqlite 3.4.2 w/ php5-sqlite (ubuntu hardy) and I've got some complex queries that were written using the group_concat() function.

Now, this function isn't supported in version 3.4.2 of sqlite, and I can't for the life of me alter to the query to NOT use group_concat().

So, is it even possible?

Example开发者_Python百科 below:

delete from table x where (select group_concat(id) || ',' from users where department_id = NEW.id) like '%' || x.id || ',%';


Alright, well I've found the 'solution': turns out its extremely easy to upgrade the sqlite3 version that the PDO driver is using:

wget http://us.archive.ubuntu.com/ubuntu/pool/main/s/sqlite3/libsqlite3-0_3.7.4-2ubuntu5_i386.deb
sudo dpkg -i libsqlite3-0_3.7.4-2ubuntu5_i386.deb
sudo invoke-rc.d lighttpd force-reload

While the ideal situation would be to upgrade the application to the latest LTS release of Ubuntu - due to time constraints, that was not really an option.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号