sql - Query to search multiple columns -


i have similar table below:

name    city    state   country ----    ----    -----   ------- sree    mm      ap      ind sree    redmond ny      rahul   hyd     ap      ind xxx     mm      ap      ind abcd    mm      tn      ind wer     dd      ap      ind 

if search mm,ap need these.

name   city    state   country ----   ----    -----   ------- sree    mm      ap      ind xxx     mm      ap      ind abcd    mm      tn      ind wer     dd      ap      ind 

if 2 words match should come first if contains in city second state , third country.

please me this.

declare @city nvarchar(50) = 'mm',         @state nvarchar(50) = 'ap'  select * (select *     yourtable     city = @city or state = @state     )z order case when city = @city , state = @state 1               when city = @city 2               else 3           end 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -