c# - Match data in SQL Server database using multiple and varying columns -


we have database table consisting of 6 "header" criteria , need match combination of these columns retrieve detail data.

we wont know of criteria underlying database have each of 8 header columns optional.

using example data :-

first name, last name, home town, age, gender, skill       , salary  james     , smith    , new york ,  30, male  , train driver, 30000 pete      , jones    , ?        ,  30, male  , ?           , 35000 ?         , smith    , new york ,   ?, male  , ?           , 75000 ?         , ?        , ?        ,  30,       , ?           , 30000 

when want find salary might specify :-

first name = james last name = smith home town = new york age = 30 gender = male skill = train driver 

using criteria expect 1st, 3rd , 4th row returned.

is there slick way of doing apart iteratively working through criteria different combinations?!

many in advance.

in mysql use ifnull() (i think there equivalent nvl() method in sql server)

e.g.

in query:

where ifnull(row.firstname, "james") == "james" , ifnull(row.lastname, "smith") , ..

even better use or (i.e. check firstnames match or row.firstname null)


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -