|
Hello,
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
ASymbol=XXX
FinSymbol=YYY
but my results also include
ASymbol=AAA
FinSymbol=BBB
FinSymbol=AAA
so results look like
ASymbol/FinSymbol
XXX/ YYY
AAA/ BBB ( i want to exclude this since AAA has a matching value)
here's the query
select
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...
thanks,
|