Thursday, 26 May 2016

[firebird-support] Finding a single row

Hi,

I have a table where I keep some part from the beginning of a discount card
number. Length of beginning is variable. User provides a complete card
number at runtime, I need to find a single row in my table which begins as
the complete card number, or I need to know no match exists in my table.

I might do it coding in my application, but that would be way too slow
compared to an SQL statement I assume.

Table is as follows.
CREATE TABLE FIYATKODLARI(
Kodu Varchar(30) NOT NULL PRIMARY KEY
);

It contains something like:
Kodu
----
SA
SB
SSC
SAA
SBDE
8694
125

Complete card number may be something like:
SB1
SA25
SA325
SB1054
SAA23
86941005
12504

Below didn't work for me because complete card number is longer, and I do
lack SQL knowledge:
select * from FIYATKODLARI where Kodu like 'SB1%'

Any help is appreciated.

Thanks.
Ertan Küçükoğlu





------------------------------------

------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu. Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-digest@yahoogroups.com
firebird-support-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/

No comments:

Post a Comment