Re: MySQL and Decimals

This WebDNA talk-list message is from

2004


It keeps the original formatting.
numero = 57849
interpreted = N
texte = For you MySQL fans, this is what I discovered today: [SQLExecute conn_ref=conn1&result_var=1] SELECT ID,FORMAT(percent,2) AS PERCENT FROM QUICKFACTS ORDER by ID; [/SQLExecute] This returns the correct info. [SQLExecute conn_ref=conn1&result_var=1] SELECT * FROM QUICKFACTS ORDER by ID; [/SQLExecute] Using the default returns Integers, but not any floating point numbers; they are stored as strings, even with FLOAT (which the docs do not say) On May 14, 2004, at 10:43 AM, Larry Hewitt wrote: > An FYI... I tried FLOAT and got the same result. > > I will redo the field type and reupload the data to see if that helps. > > Thanks. > > Larry > On May 14, 2004, at 10:21 AM, John Peacock wrote: > >> Larry Hewitt wrote: >>> A database with fields defined as DECIMAL, size 10, 2 decimals >>> allows me to enter or upload information just fine manually. When I >>> try to read the data using the WEBDNA 6 SQL tags, I return the >>> machine number equivalent, not the number: ie, 1074266112 instead >>> of 2.0 >> >> I suspect that not many people use the DECIMAL field type (usually >> FLOAT is used). According to the docs DECIMAL values are actually >> stored in MySQL as strings, which may be part of the problem (though >> I have no idea why you would get such an odd "machine number" >> representation like that). >> >> One thing you could try is applying various mathematical operations >> to the field in your select statement: >> >> select dec_field+0 as new_dec, ... >> >> and see if WebCat deals with it appropriately... >> >> John >> >> -- >> John Peacock >> Director of Information Research and Technology >> Rowman & Littlefield Publishing Group >> 4501 Forbes Boulevard >> Suite H >> Lanham, MD 20706 >> 301-459-3366 x.5010 >> fax 301-429-5748 >> >> ------------------------------------------------------------- >> This message is sent to you because you are subscribed to >> the mailing list . >> To unsubscribe, E-mail to: >> To switch to the DIGEST mode, E-mail to >> >> Web Archive of this list is at: http://webdna.smithmicro.com/ >> >> > > > Larry Hewitt360.807.1100 OFFICE > HCO, LLC360.807.1103 FAX > 1133 Kresky NE #106360.508.6231 CELL > Centralia, WA 98531larryh@hewittco.com > www.hewittco.comwww.votewashington.org > > > ------------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > > Web Archive of this list is at: http://webdna.smithmicro.com/ > > Larry Hewitt360.807.1100 OFFICE HCO, LLC360.807.1103 FAX 1133 Kresky NE #106360.508.6231 CELL Centralia, WA 98531larryh@hewittco.com www.hewittco.comwww.votewashington.org ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: MySQL and Decimals ( "Sal" 2004)
  2. Re: MySQL and Decimals ( Larry Hewitt 2004)
  3. Re: MySQL and Decimals ( John Peacock 2004)
  4. Re: MySQL and Decimals ( Larry Hewitt 2004)
  5. Re: MySQL and Decimals ( Larry Hewitt 2004)
  6. Re: MySQL and Decimals ( Larry Hewitt 2004)
  7. Re: MySQL and Decimals ( John Peacock 2004)
  8. MySQL and Decimals ( Larry Hewitt 2004)
For you MySQL fans, this is what I discovered today: [SQLExecute conn_ref=conn1&result_var=1] SELECT ID,FORMAT(percent,2) AS PERCENT FROM QUICKFACTS ORDER by ID; [/SQLExecute] This returns the correct info. [SQLExecute conn_ref=conn1&result_var=1] SELECT * FROM QUICKFACTS ORDER by ID; [/SQLExecute] Using the default returns Integers, but not any floating point numbers; they are stored as strings, even with FLOAT (which the docs do not say) On May 14, 2004, at 10:43 AM, Larry Hewitt wrote: > An FYI... I tried FLOAT and got the same result. > > I will redo the field type and reupload the data to see if that helps. > > Thanks. > > Larry > On May 14, 2004, at 10:21 AM, John Peacock wrote: > >> Larry Hewitt wrote: >>> A database with fields defined as DECIMAL, size 10, 2 decimals >>> allows me to enter or upload information just fine manually. When I >>> try to read the data using the WEBDNA 6 SQL tags, I return the >>> machine number equivalent, not the number: ie, 1074266112 instead >>> of 2.0 >> >> I suspect that not many people use the DECIMAL field type (usually >> FLOAT is used). According to the docs DECIMAL values are actually >> stored in MySQL as strings, which may be part of the problem (though >> I have no idea why you would get such an odd "machine number" >> representation like that). >> >> One thing you could try is applying various mathematical operations >> to the field in your select statement: >> >> select dec_field+0 as new_dec, ... >> >> and see if WebCat deals with it appropriately... >> >> John >> >> -- >> John Peacock >> Director of Information Research and Technology >> Rowman & Littlefield Publishing Group >> 4501 Forbes Boulevard >> Suite H >> Lanham, MD 20706 >> 301-459-3366 x.5010 >> fax 301-429-5748 >> >> ------------------------------------------------------------- >> This message is sent to you because you are subscribed to >> the mailing list . >> To unsubscribe, E-mail to: >> To switch to the DIGEST mode, E-mail to >> >> Web Archive of this list is at: http://webdna.smithmicro.com/ >> >> > > > Larry Hewitt360.807.1100 OFFICE > HCO, LLC360.807.1103 FAX > 1133 Kresky NE #106360.508.6231 CELL > Centralia, WA 98531larryh@hewittco.com > www.hewittco.comwww.votewashington.org > > > ------------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > > Web Archive of this list is at: http://webdna.smithmicro.com/ > > Larry Hewitt360.807.1100 OFFICE HCO, LLC360.807.1103 FAX 1133 Kresky NE #106360.508.6231 CELL Centralia, WA 98531larryh@hewittco.com www.hewittco.comwww.votewashington.org ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Larry Hewitt

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

NT vs Mac (1997) Order not created error (never mind) (1997) WC Database Format (1997) HELP WITH DATES (1997) Spawning Holdup? (2000) E-mail Attachments (1997) RE: Answer: WebDelivery downloads alias, not original ? (1997) sorting and grouping (1998) too many nested ... problem (1997) Nesting Search Within Tag? (1997) Deleting Orders (1997) Dubble Sku's in a Database (1999) How do I get WebCatalog to interpret WebDNA tags in.html files? (1997) shipcost - fed up with the old way (1998) WebMerchant 1.6 and SHTML (1997) Multiple Newcarts (1996) database size? (1997) Which beta for w* 4.1 and a problem w/b12 (1999) Math with Time (1997) WebCat2b13MacPlugIn - [showif][search][/showif] (1997)