By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,842 Members | 2,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,842 IT Pros & Developers. It's quick & easy.

Comparing Two Values in the same Table

P: 1

in the query below, i'm trying to compare the first 3 characters of the symbol value ASymbol with first 3 characters of FinSymbol which are in the same table. You can have more than one FinSymbol in the table. is there a way to compare ASymbol to all FINSymbols? The query should only give results when ASymbol does not match any FINSymbols

currently, this query is giving me results when


but my results also include


so results look like

AAA/ BBB ( i want to exclude this since AAA has a matching value)

here's the query

left(a.symbolvalue,3) ASymbol ,
left (fin.symbolvalue,3) FinSymbol
from Symbol_table a (nolock)
join Symbol_table fin (nolock)
on fin.CompanyID = a.CompanyID
and fin.symbolID =4 and fin.exchangeID = 2
and fin.activeFlag = 1
and left(fin.symbolValue,3) <> left(a.symbolValue,3) where s.symbolTypeID = 252

any help on this is much appreciated...

Aug 6 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.