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.
Author |
Topic |
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2007-12-05 : 13:11:09
|
I am trying to find all match critera with out KEY0 that starts with was and a Settype that starts with a '*". but In my query always comes up with a mixture of was and *.What am I doing wrong here?thanksSELECT KEY0, BU + '-' + DIV AS Expr1, TYPE, SETTYPE, FR_GRFROM dbo.TESIS2WHERE (type = 'cell') OR (type = 'cel') OR (type = 'cdma') OR (type = 'gprs')ORDER BY BU, DIV, KEY0;(SELECT KEY0, BU, DIV AS Expr1, TYPE, SETTYPE, FR_GR FROM dbo.TESIS2 WHERE (settype NOT LIKE '*%') AND (KEY0 NOT LIKE 'WAS%')) |
|
X002548
Not Just a Number
15586 Posts |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-05 : 13:28:44
|
[code]SELECT KEY0, BU + '-' + DIV AS Expr1, TYPE, SETTYPE, FR_GRFROM dbo.TESIS2WHERE type IN ('cell', 'cel', 'cdma', 'gprs')ORDER BY BU, DIV, KEY0SELECT KEY0, BU + '-' + DIV AS Expr1, TYPE, SETTYPE, FR_GRFROM dbo.TESIS2WHERE NOT (settype LIKE '*%' OR KEY0 LIKE 'WAS%')[/code] E 12°55'05.25"N 56°04'39.16" |
 |
|
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2007-12-05 : 13:47:33
|
I dont want to seewas 414-4259 8930-0000 CEL *MOTQ FR804610 (was and *)but414-4259 8930-0000 CEL *MOTQ FR804610orwas 414-4259 8930-0000 CEL MOTQ FR804610is fine to see |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-05 : 13:50:18
|
Change the OR to AND? E 12°55'05.25"N 56°04'39.16" |
 |
|
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2007-12-07 : 12:08:17
|
Peso, thanks that is what I ended up doing.thanks for the help, this forum is great! |
 |
|
|
|
|
|
|