Date: 09/28/00
- Next message: Keith Spiller: "[PHP-DB] Formatted Text"
- Previous message: Alex Black: "[PHP-DB] metabase / oracle sequences"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I am assuming that the db is Postgresql ....
Postgresql appears to cast "bare" numbers as float8 ( at least in 7.1 dev version I am running it does ...)
so change your query to
SELECT * FROM tavola_pesi WHERE ((da_kg < 3.5::numeric) and (a_kg >= 3.5::numeric))
or
SELECT * FROM tavola_pesi WHERE ((da_kg < cast( 3.5 as numeric) and (a_kg >= cast(3.5 as numeric)))
which is probably better
Cheers
Mark
> -----Original Message-----
> From: Enrico Comini [SMTP:algobit <email protected>]
> Sent: Thursday, September 28, 2000 8:57 PM
> To: ML-PHP-DB
> Subject: CAST
>
> Hi, how I have to change the next query ?
>
> da_kg=Numeric
> a_kg =Numeric
>
> cusiodb=# SELECT * FROM tavola_pesi WHERE ((da_kg < 3.5) and (a_kg >= 3.5));
> ERROR: Unable to identify an operator '<' for types 'numeric' and 'float8'
> You will have to retype this query using an explicit cast
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Keith Spiller: "[PHP-DB] Formatted Text"
- Previous message: Alex Black: "[PHP-DB] metabase / oracle sequences"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

