Author |
Topic |
gemispence
Yak Posting Veteran
71 Posts |
Posted - 2006-02-23 : 10:38:04
|
I'm trying to use multiple where clauses but its not working. I want it to look something like this:INSERT INTO [USCondex_Development].[dbo].[miamiheraldExceptions]([InvalidEmails], [InvalidAdPrintID], [InvalidPropertyStreetAddress], [InvalidPropertyPrice])SELECT [AdvertiserEmail],[AdPrintId],[AdvertiserAddress], [PropertyPrice]FROM [Development].[dbo].[table2]WHERE advertiseremail is NULLand WHERE adPrintID is NULLand WHERE firstinsertdate is NOT NULLand WHERE propertystreetaddress is NOT NULLand WHERE propertyprice < 100But it's not working. |
|
X002548
Not Just a Number
15586 Posts |
|
X002548
Not Just a Number
15586 Posts |
Posted - 2006-02-23 : 10:50:16
|
...and I need to read these things more closely...(having what the problem though, might have helped)INSERT INTO [USCondex_Development].[dbo].[miamiheraldExceptions]( [InvalidEmails] , [InvalidAdPrintID] , [InvalidPropertyStreetAddress] , [InvalidPropertyPrice]) SELECT [AdvertiserEmail] , [AdPrintId] , [AdvertiserAddress] , [PropertyPrice] FROM [Development].[dbo].[table2] WHERE advertiseremail is NULL AND adPrintID is NULL AND firstinsertdate is NOT NULL AND propertystreetaddress is NOT NULL AND propertyprice < 100 Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
|
|
gemispence
Yak Posting Veteran
71 Posts |
Posted - 2006-02-23 : 10:52:27
|
I've created an exceptions table to put all the columns from another table into that meet the criteria below in the WHERE CLAUSES, but the syntax below is not accurate as it pertains to the WHERE clauses:INSERT INTO [USCondex_Development].[dbo].[miamiheraldExceptions]([InvalidEmails], [InvalidAdPrintID], [InvalidPropertyStreetAddress], [InvalidPropertyPrice])SELECT [AdvertiserEmail],[AdPrintId],[AdvertiserAddress], [PropertyPrice]FROM [Development].[dbo].[table2]WHERE advertiseremail is NULLand WHERE adPrintID is NULLand WHERE firstinsertdate is NOT NULLand WHERE propertystreetaddress is NOT NULLand WHERE propertyprice < 100 |
|
|
gemispence
Yak Posting Veteran
71 Posts |
Posted - 2006-02-23 : 10:53:25
|
Thanks so much got it. |
|
|
gemispence
Yak Posting Veteran
71 Posts |
Posted - 2006-02-23 : 10:57:33
|
Wait I'm sorry that's not quite it. I don't want the AND operator b/c I don't want to match up the value to each of the AND's, I want the statement to evaluate different columns w/ different criteria...hence multiple WHERE clauses. thanks. |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2006-02-23 : 11:42:04
|
Then it sounds like you might want OR in some cases.you need to state your criteria clearly before we can help you write it.Understanding boolean logic is a key to using SQL Server. My advice: make sure you know how AND, OR and NOT all work, how and when to parenthesis, and so on, before progressing too much further with SQL. |
|
|
X002548
Not Just a Number
15586 Posts |
|
|