Subject | Re: [firebird-support] SQL Question |
---|---|
Author | Robert martin |
Post date | 2005-12-06T23:20:14Z |
Hi
Yeah I tried that first too however numeric strings order differently to
numeric values (thus my cast) and the < 'A' doesn't filter out text
items like 1234fred.
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
Fabio Gomes wrote:
Yeah I tried that first too however numeric strings order differently to
numeric values (thus my cast) and the < 'A' doesn't filter out text
items like 1234fred.
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
Fabio Gomes wrote:
>I m newbie in sql, but i did something similar like this:
>
>SELECT FIRST 1 ClientCode
>FROM Client
>WHERE ClientCode < 'A'
>ORDER BY ClientCode DESC
>
>btw.. i dont know if its gonna work.. it was just what came to my mind >D
>
>On 12/6/05, Robert martin <rob@...> wrote:
>
>
>> Hi
>>
>>I have a table with a VarChar(20) field. It is commonly used for
>>storing numbers but (obviously) can also be used to store Chars. I want
>>to find the highest numeric value in this field (so I can add a new
>>record with a unique numeric value i.e. max + 1).
>>
>>I tried
>>
>>SELECT MAX(CAST(ClientCode AS BigInt)) AS MaxCode
>>FROM Client
>>WHERE ClientCode < 'A'
>>
>>This however fails as 2334324L is less than 'A'. I know there might be
>>a UDF that does this but we are trying to stick to the standard Firebird
>>install libraries. Does anybody have a suggestion of how to do it ?
>>
>>
>>--
>>Rob Martin
>>Software Engineer
>>
>>phone +64 03 377 0495
>>fax +64 03 377 0496
>>web www.chreos.com
>>
>>Wild Software Ltd
>>
>>
>>
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>
>>Visit http://firebird.sourceforge.net and click the Resources item
>>on the main (top) menu. Try Knowledgebase and FAQ links !
>>
>>Also search the knowledgebases at http://www.ibphoenix.com
>>
>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>
>>
>>
>> ------------------------------
>>YAHOO! GROUPS LINKS
>>
>>
>> - Visit your group "firebird-support<http://groups.yahoo.com/group/firebird-support>"
>> on the web.
>>
>> - To unsubscribe from this group, send an email to:
>> firebird-support-unsubscribe@yahoogroups.com<firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>>
>> - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>> Service <http://docs.yahoo.com/info/terms/>.
>>
>>
>> ------------------------------
>>
>>
>>
>
>
>[Non-text portions of this message have been removed]
>
>
>
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Visit http://firebird.sourceforge.net and click the Resources item
>on the main (top) menu. Try Knowledgebase and FAQ links !
>
>Also search the knowledgebases at http://www.ibphoenix.com
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>