update query to include additional search fields

need to add 3 additional search fields in the select case statement.

SELECT distinct Iif(wwgsku = '44055', 'WSKU', 
      Iif(WWGMfrNumCondensed = '44055', 'WMFR',
      Iif([CompSKUCondensed] = '44055', 'CSKU',
      Iif([CompMfrNumCondensed] = '44055', 'CMFR', 'NA')))) as Match_Type
      , a.*
FROM main_xref_t1_1 as a
  where [CompMfrNumCondensed] = '44055'
  or [CompSKUCondensed] = '44055'
  or wwgsku = '44055'
  or WWGMfrNumCondensed = '44055' 

Open in new window



Fields I need added are:

compmfgname = "MSC"
compVname = "MSC"
WwName = "MSC"


tHANKS
fordraiders
LVL 3
FordraidersAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaauCommented:
Are these additional fields needed to be added as OR or AND conditions?
0
FordraidersAuthor Commented:
OR
0
chaauCommented:
Just continue to add them to the end of the WHERE clause:
SELECT distinct Iif(wwgsku = '44055', 'WSKU', 
      Iif(WWGMfrNumCondensed = '44055', 'WMFR',
      Iif([CompSKUCondensed] = '44055', 'CSKU',
      Iif([CompMfrNumCondensed] = '44055', 'CMFR', 'NA')))) as Match_Type
      , a.*
FROM main_xref_t1_1 as a
  where [CompMfrNumCondensed] = '44055'
  or [CompSKUCondensed] = '44055'
  or wwgsku = '44055'
  or WWGMfrNumCondensed = '44055' 
  or compmfgname = 'MSC'
  or compVname = 'MSC'
  or WwName = 'MSC'

Open in new window

Do not forget to use single quotes for the string literals
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

FordraidersAuthor Commented:
this is the current sql...
SELECT main_xref_t1_1.WWGSKU, main_xref_t1_1.WWGShortDesc, main_xref_t1_1.WWGLongDesc, main_xref_t1_1.WWGMfrNum, main_xref_t1_1.WWGMfrNumCondensed, main_xref_t1_1.WWGVdrBrandName, main_xref_t1_1.WWGUOM, main_xref_t1_1.WWGUOMQty, main_xref_t1_1.WWGPrice, main_xref_t1_1.WWGSlsStatus, main_xref_t1_1.WWGCatalogPgNo, main_xref_t1_1.CompMfrNum, main_xref_t1_1.CompMfrNumCondensed, main_xref_t1_1.CompMfrName, main_xref_t1_1.CompSKU, main_xref_t1_1.CompSKUCondensed, main_xref_t1_1.CompName, main_xref_t1_1.CompSKUDesc, main_xref_t1_1.CompUOM, main_xref_t1_1.CompUOMQty, main_xref_t1_1.CompPrice, main_xref_t1_1.XRefType, main_xref_t1_1.XRef_Comment, main_xref_t1_1.WWGCAOrange, main_xref_t1_1.WWGCAWhite, main_xref_t1_1.WWGCountry, main_xref_t1_1.WWGGreen, main_xref_t1_1.WWGExclBrand, main_xref_t1_1.WWGGSAComplaint, main_xref_t1_1.WWGParentSKU, main_xref_t1_1.WWGDivision, main_xref_t1_1.WWGSlsStatus
FROM main_xref_t1_1
WHERE (((main_xref_t1_1.WWGSKU)="44054")) OR (((main_xref_t1_1.WWGMfrNumCondensed)="44054") AND ((main_xref_t1_1.WWGVdrBrandName)="WESTWARD")) OR (((main_xref_t1_1.CompMfrNumCondensed)="44054") AND ((main_xref_t1_1.CompMfrName)="WESTWARD")) OR (((main_xref_t1_1.CompSKUCondensed)="44054") AND ((main_xref_t1_1.CompName)="WESTWARD") AND ((main_xref_t1_1.WWGSlsStatus)<>"wg" And (main_xref_t1_1.WWGSlsStatus)<>"wv" And (main_xref_t1_1.WWGSlsStatus)<>"dg" And (main_xref_t1_1.WWGSlsStatus)<>"dv"));


would like to read in the case select format ?

Thanks
fordraiders

Open in new window

0
FordraidersAuthor Commented:
SELECT distinct Iif(wwgsku = '44054', 'WSKU',
      Iif(WWGMfrNumCondensed = '44054', 'WMFR',
      Iif([CompSKUCondensed] = '44054', 'CSKU',
      Iif([CompMfrNumCondensed] = '44054', 'CMFR', 'NA')))) as Match_Type
      , a.WWGSKU, a.WWGShortDesc, a.WWGLongDesc, a.WWGMfrNum, a.WWGMfrNumCondensed, a.WWGVdrBrandName, a.WWGUOM, a.WWGUOMQty, a.WWGPrice, a.WWGSlsStatus, a.WWGCatalogPgNo, a.CompMfrNum, a.CompMfrNumCondensed, a.CompMfrName, a.CompSKU, a.CompSKUCondensed, a.CompName, a.CompSKUDesc, a.CompUOM, a.CompUOMQty, a.CompPrice, a.XRefType, a.XRef_Comment, a.WWGCAOrange, a.WWGCAWhite, a.WWGCountry, a.WWGGreen, a.WWGExclBrand, a.WWGGSAComplaint, a.WWGParentSKU, a.WWGDivision, a.WWGSlsStatus
FROM main_xref_t1_1 as a
where [CompMfrNumCondensed] = '44054' AND CompMfrName = "CRAFTSMAN"
OR [CompSKUCondensed] = '44054' AND CompName = "CRAFTSMAN"
OR WWGVdrBrandName = "CRAFTSMAN" AND  WWGMfrNumCondensed = '44054'
OR wwgsku = '44054'
 
This works...
0
FordraidersAuthor Commented:
Thanks very much for being up this late !!!!!
saved me 5 hours work !
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.