|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Can anyone tell me how to correct this error message: Line 9: Incorrect syntax near '='.
Code:
SELECT customerId AS "Customer ID", lastName AS "Last Name", phone AS "Phone", DATENAME(MONTH, saleDate) + ' ' + DATENAME(DAY, saleDate) + ', ' + DATENAME(YEAR, saleDate) AS "Sale Date" FROM Customer, Sale WHERE saleDate BETWEEN (DATENAME(MONTH, saleDate) = 'June' DATENAME(DAY, saleDate) = '1') AND (DATENAME(MONTH, saleDate) = 'June' DATENAME(DAY, saleDate) = '7') Perhaps I defined my variables wrong? |
|
#2
|
||||
|
||||
|
do you want sales for june 1-7 for all years, or for just a specific year? just for the current year?
also, you need a join condition between customer and sales tables, otherwise you will get every customer with every sales record, m * n results, whether the sale belongs to that customer or not |
|
#3
|
||||
|
||||
|
oh, man, you already had the answer to this!
see http://forums.devshed.com/t207139/s.html please don't do that and i think you'd better go look at your class materials again ![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > incorrect syntax near '=' |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|