January 15, 2007 at 11:48 am
i have 2 columns i need to compare them, the data is close to equal but one has a prefix
example:
tbl_a , tbl_b
LINK_100, 100
here is my query
select * from tbl_a where a_id in ('select b_id from tbl_b')
can i input LINK_ somewhere to make the columns equal?
I cannot alter the tables data
thanks for viewing
January 15, 2007 at 12:13 pm
What is in the actual data?
The prefix 'link_'
or an actual dynamic [web page] link?
Some actual sample data would greatly help us generate the adequate solution.
January 15, 2007 at 12:35 pm
the table names are
tbl_a , tbl_b
and the columns are
LINK_100, 100
LINK_101, 101
January 15, 2007 at 12:43 pm
select a.* from tbl_a a inner join tbl_b b on REPLACE(a_id, 'LINK_', '') = b.b_id
January 15, 2007 at 1:36 pm
perfect that worked like a charm
thank you for your help
January 18, 2007 at 3:35 pm
Could also do the following:
select * from Tbla
join tblb
on tbla.id = 'Link_' + tblb.id
Don Urquhart
January 18, 2007 at 4:31 pm
Or:
select a.* from tbl_a a inner join tbl_b b on RIGHT(a.col1,3) = b.col1
-SQLBill
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply