December 8, 2010 at 4:13 am
Hi all,
I am trying to execute the following query
SELECT TOP 100 ADDRESSLINE1 FROM MST_ADDRESS WHERE ADDRESSLINE1 LIKE
(SELECT ''+KEY_WORD+'%' FROM DIGITLOOKUPS.dbo.INPROGRESS_POBOX_EXCLUSION_LOOKUP)
but striking with an error sub query returned more than one value.
I understood why and what the error is about , but no idea how to resolve and retrieve the data I want.
Any help is highly appreciated.
Thanks
December 8, 2010 at 4:29 am
SELECT TOP 100 ADDRESSLINE1 FROM MST_ADDRESS WHERE ADDRESSLINE1 in
(SELECT colName FROM DIGITLOOKUPS.dbo.INPROGRESS_POBOX_EXCLUSION_LOOKUP where colName like ''+KEY_WORD+'%')
maybe?
December 8, 2010 at 4:33 am
Thanks for the reply.
I have tried that way already but is not working.
All I want is to select a column addressline from a table mst_address where addressline like key_word+'%'. Here key_word is a column in another table called lookup.
Any help please?
December 8, 2010 at 4:39 am
SELECT TOP 100 ADDRESSLINE1 FROM MST_ADDRESS ma WHERE EXISTS
(SELECT 1 FROM DIGITLOOKUPS.dbo.INPROGRESS_POBOX_EXCLUSION_LOOKUP pel WHERE ms.ADDRESSLINE1 LIKE pel.KEY_WORD+'%')
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply