puedo hacer esta consulta en postgres?

 

son campos de tipo date, de los cuales quiero extaer el mes y año directamente 
en la consulta sql.

 

el formato es 2007-07-04

 

$sql=pg_query($link,"SELECT MONTH(ps.iniciogestion) AS mesinicio, 
YEAR(ps.iniciogestion) AS anioinicio, 
DATEDIFF(ps.iniciogestion,ps.finalgestion) AS duracion, MONTH(ps.finalgestion) 
AS mesfinal, YEAR(ps.finalgestion) AS aniofinal  FROM programasedes AS ps");

 

 

pero me da este error

 

Warning: pg_query() [function.pg-query]: Query failed: ERROR: function 
month(date) does not exist LINE 1: ...MONTH(ps.i... ^ HINT: No function matches 
the given name and argument types. You might need to add explicit type casts. 
in E:\AppServ\www\finanzas\includes\sqldatabase.php on line 37

 

 

 

saludos y gracias por su tiempo

 

Jhonvels





_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

Responder a