Subject | Select based on a partial match |
---|---|
Author | Dixon Epperson |
Post date | 2004-02-16T16:41:24Z |
Is there a way to do a select statement where field one matches part
of field2?
example
SELECT s.TAXNAME, t.TAXVAL FROM SALESREG s, TAXTBL t
WHERE s.TAXNAME[1,2]=t.NAME
SALESREG.TAXNAME WOULD BE A CHAR(6), IT COULD HOLD UP TO THREE
2 CHARACTER TAX NAME SUCH AS 'ILCOCC'.
'IL' WOULD BE ILLINOIS, 'CO'WOULD BE COOK COUNTY, AND 'CC' WOULD BE
CHICAGO CITY.
I WOULD NEED TO GET THE TAX VALUE FOR 'IL', FOR 'CO' AND 'CC'.
IN DELPHI I WOULD USE A FUNCTION LIKE COPY(s.TAXNAME, 1,2) TO GET THE
FIRST 2 CHARACTER, COPY(s.TAXNAME, 3,2) FOR THE TWO MIDDLE ONES, ETC.
IS THERE AN SQL FUNCTION IN FIREBIRD THAT WILL ALLOW THAT?
Dixon Epperson
of field2?
example
SELECT s.TAXNAME, t.TAXVAL FROM SALESREG s, TAXTBL t
WHERE s.TAXNAME[1,2]=t.NAME
SALESREG.TAXNAME WOULD BE A CHAR(6), IT COULD HOLD UP TO THREE
2 CHARACTER TAX NAME SUCH AS 'ILCOCC'.
'IL' WOULD BE ILLINOIS, 'CO'WOULD BE COOK COUNTY, AND 'CC' WOULD BE
CHICAGO CITY.
I WOULD NEED TO GET THE TAX VALUE FOR 'IL', FOR 'CO' AND 'CC'.
IN DELPHI I WOULD USE A FUNCTION LIKE COPY(s.TAXNAME, 1,2) TO GET THE
FIRST 2 CHARACTER, COPY(s.TAXNAME, 3,2) FOR THE TWO MIDDLE ONES, ETC.
IS THERE AN SQL FUNCTION IN FIREBIRD THAT WILL ALLOW THAT?
Dixon Epperson