Re: interesting sequence

Поиск
Список
Период
Сортировка
От John Fabiani
Тема Re: interesting sequence
Дата
Msg-id 201107051442.29875.johnf@jfcomputer.com
обсуждение исходный текст
Ответ на Re: interesting sequence  (Kevin Crain <kevin.crain1@gmail.com>)
Ответы Re: interesting sequence
Список pgsql-sql
On Tuesday, July 05, 2011 01:11:11 pm Kevin Crain wrote:
> You don't need a loop there.  Assuming your order id field is of type
> varchar you can just build the first part of your string and then do a
> count to get the last part using a LIKE comparison:
> 
> select count(id_order) + 1  from sometable WHERE id_order LIKE 'O-20110704
> -%';
> 
> If you do this inside a function it will be like running it in a
> transaction so you shouldn't have to worry about it being a multi-user
> system.
> 
> 
> 

I like this - looks better than what I'm currently doing.  Thanks
Johnf


В списке pgsql-sql по дате отправления:

Предыдущее
От: Viktor Bojović
Дата:
Сообщение: overload
Следующее
От: Samuel Gendler
Дата:
Сообщение: Re: interesting sequence