RE: Displaying output from MySQL

2002-12-11 Thread Adolfo Bello
SELECT * FROM your_table WHERE your_number_field REGEXP "\."

> -Original Message-
> From: Beauford.2003 [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, December 12, 2002 3:26 AM
> To: [EMAIL PROTECTED]
> Subject: Displaying output from MySQL
> 
> 
> Hi,
> 
> Not sure if this is a PHP of a MySQL question, so I am 
> sending it to both groups. Basically I have a list of numbers 
> with two decimal places in the MySQL database, but I only 
> want to display some of them with the decimal points.
> 
> i.e.
> 
> 70 (not 70.00)
> 87
> 51.5
> 46.75
> 12
> 29
> 5.5
> -1
> 45
> 
> I know it's probably a weird request, but any thoughts on how 
> one would do this either through PHP or MySQL.
> 
> TIA
> 
> 
> 
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail 
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 
> 
> 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Displaying output from MySQL

2002-12-11 Thread Benjamin Pflugmann
Hi.

On Thu 2002-12-12 at 02:25:51 -0500, [EMAIL PROTECTED] wrote:
> Hi,
> 
> Not sure if this is a PHP of a MySQL question, so I am sending it to both
> groups. 

Usually it is preferred that you send it only to the list which is
more appropriate first (toss a coin, if you must ;-) and only if you
get no satisfying answer, try the other one. Cross-posting is usually
frowned upon.

> Basically I have a list of numbers with two decimal places in the
> MySQL database, but I only want to display some of them with the
> decimal points.
> 
> i.e.
> 
> 70 (not 70.00)
> 87
> 51.5
> 46.75
> 12
> 29
> 5.5
> -1
> 45
> 
> I know it's probably a weird request, but any thoughts on how one would do
> this either through PHP or MySQL.

You can use TRIM for that purpose:

  SELECT TRIM(TRAILING '.' FROM TRIM(TRAILING '0' FROM column)) ...

HTH,

Benjamin.



-- 
[EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php