You are here: Syntax Help! « MsSQL Server « IT news, forums, messages
Syntax Help!

Posted by jared.pohl@gmail.com on 09/26/80 11:46

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!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация