lundi 26 janvier 2015

cast a string as a type as a referencevariabel

I'm trying to concat a string in sqlite.


I want the result to ex. look like this grouped by each different vatpercentage: VAT 8% Total 10


Code:



select group_concat((select 'VAT' || ' ' || cast(VatPercentage as integer) as vat || ' % ' || ' Total ' || round(TotalPrice * (cast(vat / 100 as float))) || ' ' from Test group by vat having count(Amount) > 0),'')


It's complaining about when casting vatPercentage to integer and then calling it vat, but i can't see why it doesnt work?


Fiddle


Aucun commentaire:

Enregistrer un commentaire