Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Multiple Where clauses

Author  Topic 

pdx_2188
Starting Member

12 Posts

Posted - 2011-04-01 : 17:10:32
Good Afternoon,

I'm trying to create a query that will not only take out the Processor [AMD] but will also take out pieces of a description I do not want. Here is the query I'm using. I do not want AMD processors, but also do not want the 0D1 parts of a description. I feel like this should be an easy fix?


[Code]

select MFPN, [processor / manufacturer]

from vreport_data

Where

[processor / manufacturer] != 'AMD'

and Description not like '%OD1%'
or Description not like '%0D1%'

Order by [processor / manufacturer] ASC

[/Code]

Thanks,

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-04-01 : 17:12:04
Show us a data example (before and after).

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

pdx_2188
Starting Member

12 Posts

Posted - 2011-04-01 : 17:15:22
Hi Tara,
this is a small output since the actual output it about 280K rows of mostly Other processors.



Part Number Processor
PS218E-E8180-02 AMD
PS218E-E8180-FR AMD
PS218U-E81J08 AMD
PS494AA#ABA AMD
PSAEGE-00H014BT AMD
PSAEGU-00V00U AMD
PSAEGU-00W00U AMD
PSAEGU-00W00X AMD
PSAEGU-00Y00V AMD
PSAEGU-01100U AMD
PSAEGU-01800U AMD
PSAEGU-03801J AMD
PSAEGU-03C01K AMD
PSAEGU-03D01L AMD
PSAEGU-03D01L-OB AMD
PSAEGU-03L01M AMD
PSAEGU-03P01M AMD
PSAELE-01600KGR AMD
PSAELU-01H010 AMD
PSAELU-038010 AMD
PSAELU-03C01J AMD
PSAFGU-00H002 AMD
PSAFGU-00L002 AMD
PSAFGU-01V002 AMD
PSAFGU-01V007 AMD
PSAFGU-01V015 AMD
PSAFGU-01W002 AMD
PSAFGU-01X002 AMD
PSAFGU-020002 AMD
PSAFGU-020002B AMD
PSAFGU-02E002 AMD
PSAFGU-02E002B AMD
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-04-01 : 17:28:57
So using that sample data, what would you like to see as the result set?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

pdx_2188
Starting Member

12 Posts

Posted - 2011-04-01 : 17:41:17
Well I would like AMD to no longer be part of the processor list, but also be able to trim the 0D1 out of the description field. usually the 0D1 part number would look like : 123456-001 0D1 or 123456-001#0D1 I would like it to just display descriptions that display: 123456-001. I hope this is a little clearer?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-04-01 : 17:44:58
select MFPN, [processor / manufacturer], replace([description], 'OD1', '') as Description
from vreport_data
Where [processor / manufacturer] != 'AMD'
Order by [processor / manufacturer] ASC

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

pdx_2188
Starting Member

12 Posts

Posted - 2011-04-01 : 17:47:12
Thank you so much! I have never used the replace function before, but I have a feeling it will come in very handy in the future!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-04-01 : 17:52:02
You're welcome, glad to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -