![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Database Database problems or need to ask a question? maybe something to do with sql injections or a database software question. Database topics cover MySQL, PostgreSQL, Oracle, SQL Server or anything else related to databases. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hi guys.. When I try and run the following code it says that there is a missing operator.. SELECT curr.portfolio_code, curr.date, (curr.gross_index-mo1.gross_index)/mo1.gross_index AS 1MONTH_RETURN, (curr.gross_index-mo1.gross_index)/mo1.gross_index AS 3MONTH_RETURN FROM portfolio_performance AS curr LEFT OUTER JOIN portfolio_performance AS mo1 ON curr.date = dateserial(year(dateadd('d',-1,dateserial(Year([mo1].date), MONTH([mo1].date)+2, 1))), month(dateadd('d',-1,dateserial(Year([mo1].date), MONTH([mo1].date)+2, 1))),day(dateadd('d',-1,dateserial(Year([mo1].date),MONTH([mo1].date)+2, 1)))) LEFT OUTER JOIN portfolio_performance AS mo3 ON curr.date = dateserial(year(dateadd('d',-1,dateserial(Year([mo3].date), MONTH([mo3].date)+4, 1))), month(dateadd('d',-1,dateserial(Year([mo3].date), MONTH([mo3].date)+4, 1))),day(dateadd('d',-1,dateserial(Year([mo3].date),MONTH([mo3].date)+4, 1)))) ; However, when I run the same code, minus the second left outer join it works perfectly.. SELECT curr.portfolio_code, curr.date, (curr.gross_index-mo1.gross_index)/mo1.gross_index AS 1MONTH_RETURN FROM portfolio_performance AS curr LEFT OUTER JOIN portfolio_performance AS mo1 ON curr.date = dateserial(year(dateadd('d',-1,dateserial(Year([mo1].date), MONTH([mo1].date)+2, 1))), month(dateadd('d',-1,dateserial(Year([mo1].date), MONTH([mo1].date)+2, 1))),day(dateadd('d',-1,dateserial(Year([mo1].date),MONTH([mo1].date)+2, 1)))); Any help would be appreciated.. im sure its only something minor! | |||
| Featured Websites | ||||
|
![]() |
| Tags: error, syntax |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help on Syntax error please | Gilles | Database | 0 | 07-01-2007 9:30 PM |
| Syntax error? | Joneleth | Database | 2 | 07-01-2007 7:01 PM |
| Syntax Error: Newbie Help | Venture Zone | PHP | 0 | 07-01-2007 3:32 PM |
| cursor : where is my syntax error ? | jahjah92 | Database | 0 | 06-26-2007 12:08 AM |
| amazing syntax error | Oli Filth | Database | 0 | 06-10-2007 12:18 AM |
| Featured Websites | ||||
|