# question

## Sales figure in pence to £ and p

Ok I know there is a function but being out of work for a bit has left me with some blanks :( Simple qry sales amount stored in pence and need to convert it to £ and pence.Simply dividing it by 100 isn't helping. 19250 -> 192.50 10240 -> 102.40 Help please !

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

·
It's probably because you are doing integer division. Try select 19250/100.00

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

·
Hi Kev, when using [sales]/100.00 its retaining the pence value but adding extra trailing zeros 7512 -> 75.120000 How can I get rid of trailing zeros ? I remember using decimal fn sometime back to get rid of trailing zeros. Let me check if that helps else your advice will be very much helpful.
0 Likes 0 ·
·
Not to worry...the following worked wonders convert(decimal(8,2),[sales]/100.00). Thanks all!
0 Likes 0 ·
·
That's what would have suggested. Glad you found it.
0 Likes 0 ·
Does this help select 19250 / 100 select 19250 % 100

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

·
+1 ahh I see a different interpretation of the question.
0 Likes 0 ·
·
The value is stored as a column in a table. E.g.- If I do [sales]/100 its converting 7512 to 75 when ideally it should be 75.12 If I use [sales]%100 , its converting 7512 to 12 [sales] column is stored as an interger. Let me know if you need more info.
0 Likes 0 ·
·
What @tanglesoft is saying is that if you needed 2 fields from one, i.e. pounds ***and*** pence, then the integer division and integer remainder (modulo function %) would get you that.
0 Likes 0 ·