norris1023
norris1023

Reputation: 633

How to get view to work

I am working on this view. I am trying to add a view called StoreSales_vw in the Pubs database that shows the store name from all stores in California that match this criteria in the sales table: sales with quantities greater than 20 payterms greater than 'Net 30'. THis is what I have so far:

CREATE VIEW StoreSales_vw
AS
SELECT  dbo.stores.state,
            dbo.sales.qty,
           dbo.sales.payterms
FROM   dbo.sales 
INNER JOIN
         dbo.stores ON dbo.sales.stor_id = dbo.stores.stor_id
Where state ='California' quantites >20,payterm > 'Net 30'

I am getting an error on the StoreSales_vw and then by the quantities. Im not to sure how to do the last part when it is asking to do the city = california and the payterm, and quantities. I can usually do it if it is one but its asking for three things. Now would I put in more joins. Can someone explain this a little bit to me I am still new at it.

Upvotes: 1

Views: 173

Answers (1)

Curtis
Curtis

Reputation: 103348

You need to split your WHERE conditions up with AND

Where state ='California'
AND quantites >20
AND payterm > 'Net 30'

Upvotes: 4

Related Questions