[Gambas-user] Help with converting text in field to number
richard terry
rterry at ...1946...
Mon Feb 2 21:38:40 CET 2009
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
> > , at 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
More information about the User
mailing list