lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
***BOGO*** Re: How to ensure column expression gets stored as Double and not Decimal
- Date: Fri, 27 Jun 2008 13:04:37 -0500
- From: Dan Nelson <dnelson@xxxxxxxxxxxxxxx>
- Subject: ***BOGO*** Re: How to ensure column expression gets stored as Double and not Decimal
In the last episode (Jun 27), mos said:
> I'm creating a MyISAM table using a Select statement as in:
>
> create table t2 select if(col1>col2,1.2,4.1) NewCol from t1
>
> (Ok, the computations are a lot more complicated than that).
>
> For some reason the column type of NewCol is Decimal and not Double.
> How do I force the expression column to be double? I have about a
> dozen columns all set to Decimal because they are expressions and I'd
> rather they all be double. I don't want to have to do an Alter Table
> after the table is created. Any ideas?
Add a create_definition clause to your CREATE TABLE statement just as
if you were creating a blank table. That way, you can force whatever
field types you want.
http://dev.mysql.com/doc/refman/5.0/en/create-table.html
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
[(create_definition,...)]
[table_option] ...
select_statement
--
Dan Nelson
dnelson@xxxxxxxxxxxxxxx
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=royale@xxxxxxxxxx