Subject |
Re: sql decimals |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Mon, 8 Jan 2024 08:39:14 +0200 |
Newsgroups |
dbase.getting-started |
On 2024/01/08 08:31, Mervyn Bick wrote:
> The SQL function to change a column's type is CAST().
>
>
> sql = "select cast(sum(qty) as int) as qty from collection"
>
>
> It's optional but if you don't include the "as qty" in the statement the
> field in the rowset will be named "SUM of qty"
P.S
If you are simply going to display the value and not use it in a
calculation you could convert the value to characters. This would allow
you to display it left justified in an entryfield without the leading
spaces converting to an integer will introduce.
sql = "select cast(sum(qty) as char(3)) as qty from collection"
Just make sure you make the character field wide enough to hold the value.
Mervyn.
|
|