Calculated Fields in SQL

jimfrith

New Member
I am trying to return a calculated field of the system date on an sql query to a Progress database. I tried the following...

SELECT COUNT(DISTINCT AL1."control#"), DATE From ...

But I get an error saying that the "DATE" column is not found in the table.

Is there a way to return columns that are not in the Progress Table?

Thanks
Jim
 
jimfrith -

select count(distinct AL1."control#") as "Date" from pub.tablename AL1

The problem is the comma (,) you have before the word 'Date'. Also, 'Date' is probably a reserved word in Progress and most languages. So, enclose it in double quotes to force the database engine to interpret the word 'Date' as a label and not as a built-in function.
 
Calculated Field

Thanks for your reply. The reason for using the DATE field is that I want the column that is returned to contain the System Date.

I have been looking fufther, Would this involve the use of the INTO statement? I can use the "current date" function when I query a DB2 database but have not been able to get the syntax correct for the Progress database.
 
jimfrith -
I apologize that I do not have Progress SQL-89 documentation. However, in Progress SQL-92, the function is CURDATE(). Try that. I hope it works for you.
 
Back
Top