[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gambas-user
Subject:    Re: [Gambas-user] Help with converting text in field to number
From:       richard terry <rterry () pacific ! net ! au>
Date:       2009-02-02 20:38:40
Message-ID: 200902030738.40743.rterry () pacific ! net ! au
[Download RAW message or body]

On Tue, 3 Feb 2009 06:45:14 am werner 007 wrote:
> Hello Richard
>
> For me it looks you want use "Group By" instead Unions in SQL to get the
> Resultset like
>
> > xaxes-text|count|display_order
> > -------------------------------------------
> >  5-6             5               1
> >  6-7           100            2
> > over 7       10              3
>
> And to deal with Number vs Text you could use Regexp in MySQL (maybe other
> SQL engines too)
>
> > select
> >     reference_range as XAxes_text,
> >    ,count (value) as count
> >    ,@row:=@row+1 as display_order
> > From (SELECT @row:=0) as r, clin_requests.vwResults
> > Where value RegExp '[0-1]'
> > Group by reference_range
>
> Just as idea.
>
>
> Regards, Werner(007)

Thanks, I'll try this on the weekend and report back. I ended up taking the 
easy way out (benoit's suggestion) to create a numerical column. When I'm 
saving the data I do a Try val (The string) and if it converts to numerical I 
save that, otherwise insert a null value). This works fine, however I will 
try yours.

richard


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic