List:General Discussion« Previous MessageNext Message »
From:Haluk Karamete Date:July 31 2012 10:02pm
Subject:query help
View as plain text  
I've got a text field called source_recid. It stores half string half
number like strings in it.

Example

shop.orders.32442

the syntax is DATABASENAME.TABLENAME.RECID

My goal is to scan this col and find out the biggest RECID ( the
integer) in it.

So, in a case like this

shop.orders.32442
shop.orders.82000
shop.orders.34442

It would be the record whose source_recid  is shop.orders.82000. Why? Cause
82000 happens to be the largest integer.

What SQL statement would get me that record?

One option to this is to create a new column ( the_ids ) and move all the
integers in it and then run something like this

select source_recid from mytable where source_recid like 'shop.orders.%'
order by the_ids DESC LIMIT 1

Is there a way to pull this off without going thru this step?

Thread
query helpHaluk Karamete31 Jul
  • Re: query helpPaul Halliday31 Jul
    • RE: query helpRick James1 Aug
    • Re: query helpVikas Shukla1 Aug
  • Re: query helphsv7 Aug