SQL server where clause (compare more values in more values) -


select * customers ('paris','london', 'dublin', 'venice')  in (select city europe) 

select city europe return more 1 value,

how can this?

i dont want repeat condition like:

where ('paris')  in (select city customers)        or ('london')  in (select city customers)        or  ('dublin')  in (select city customers) or .... 

your second select redundant, , can "flip" in condition.

so equivalent of query is:

select * customers city in ('paris','london', 'dublin', 'venice') 

update.

based on logic you've disclosed in comments, query should like:

select * customers exists(select top 1 * europe city in ('paris','london', 'dublin', 'venice')) 

exactly stated: if exists @ least 1 of city in ('paris','london', 'dublin', 'venice') in europe customers selected, else nothing selected.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -