Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Group By statement in Interbase

Status
Not open for further replies.

SilverStray

Programmer
Oct 25, 2001
47
AU
I have two similar tables, one seated on SQL Server, and the other in Interbase.
The lines of code that follow works perfectly well in SQL Server.

--------------
select max(High) AS HIGH, min(Low) AS LOW, max(TotalVolume) as HiVol, min(TotalVolume)LowVol
from TB_Daily
where IssueID = 123 and year(TradedDte) = 1999
group by month(TradedDte)
--------------

I made an equivalent SQL statement in Interbase as follows:

--------------
select max(High) AS HIGH, min(Low) AS LOW, max(TotalVolume) as HiVol, min(TotalVolume)LowVol
from TB_Daily
where IssueID = 123 and extract(year from TradedDte) = 1999
group by extract(month from TradedDte)
-------------

My problem is, I get an SQL error in the Group By portion using the Extract keyword. I am sure there's no problem in the syntax in extracting the month of the column TradedDte. The problem is in using it with the Group By statement. What should I do inorder to get the same results as delivered through my SQL statement used in SQL Server, where it performs the aggregate functions grouped by months???

Please help!!!

JEchavez
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top