Andrew Gatt wrote:
> 
> Error: wrong number of arguments to function substr()
> 
> I'm using sqlite 3.3.6, but i'm presuming the two and three variable 
> substr functions go back further than this? Doing tests it seems to be 
> the two variable version it doesn't like. Do i need to upgrade my sqlite 
> library?
> 

Yes, this feature was added in version 3.5.2 (see 
http://www.sqlite.org/changes.html) so you will need to upgrade to use 
this form of the function.

If you can't upgrade you simply need to calculate the length as well.

select * from t
order by
     case
         when lower(substr(artist, 1, 4)) = 'the,'
             then substr(artist, 5, length(artist)-4)
         when lower(substr(artist, 1, 3)) = 'the'
             then substr(artist, 4, length(artist)-3)
         else artist
     end;

HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to