Funciones dentro de un subquery (subconsulta)
Publicado por Manuel Raygoza (3 intervenciones) el 31/07/2008 18:24:32
Que tal. Tengo un problema con un subquery. quiero utilizar las funciones basicas y no funcionan.
Por ejemplo quiero utilizar la funcion FLOOR que me devuelve el numero entero de una division. Solo me funciona cuando hago la consulta directa o primer consulta. En el subquery no. ¿que es lo que pasa?
A continuacion muestro un ejemplo:
1er. query estoy manejando el datasourse
<cfquery name="qryObtieneClaves" datasource="dtsMIPF_pru" >
SELECT NUM_MINISTRA, COLUMNA1, COLUMNA2, COLUMNA3
FROM CATALOGOS
</cfquery>
2DO. QUERY ESTOY MANEJANDO EL DBTYPE
<cfquery name="qryResultado" dbtype="query">
SELECT NUM_MINISTRA, COUNT(*) AS TOTAL_REGISTROS, FLOOR (count(*)/12) as HOJAS_COMPLETAS FROM qryObtieneClaves
GROUP BY NUM_MINISTRA
</cfquery>
Me marca el siguiente error:
Error Executing Database Query.
Query Of Queries syntax error.
Encountered "(. Incorrect Select Statement, Expecting a 'FROM', but encountered '(' instead, A select statement should have a 'FROM' construct.
The error occurred in C:InetpubwwwrootpruebalineaqryRepCLC.cfm: line 70
68 :
69 : <!--- FLOOR((SELECT MAX(ROWNUM) FROM RF_TR --->
70 : <cfquery name="qryObtieneClaves" dbtype="query">
71 : SELECT NUM_MINISTRA, COUNT(*) AS TOTAL_REGISTROS, FLOOR(count(*)/12) as HOJAS_COMPLETAS FROM QRYCARGA_CLC
72 : GROUP BY NUM_MINISTRA
--------------------------------------------------------------------------------
SQL SELECT NUM_MINISTRA, COUNT(*) AS TOTAL_REGISTROS, FLOOR(count(*)/12) as HOJAS_COMPLETAS FROM QRYCARGA_CLC GROUP BY NUM_MINISTRA
Please try the following:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
¿ALGUIEN SABE COMO SOLUCIONAR ESTO?
Por ejemplo quiero utilizar la funcion FLOOR que me devuelve el numero entero de una division. Solo me funciona cuando hago la consulta directa o primer consulta. En el subquery no. ¿que es lo que pasa?
A continuacion muestro un ejemplo:
1er. query estoy manejando el datasourse
<cfquery name="qryObtieneClaves" datasource="dtsMIPF_pru" >
SELECT NUM_MINISTRA, COLUMNA1, COLUMNA2, COLUMNA3
FROM CATALOGOS
</cfquery>
2DO. QUERY ESTOY MANEJANDO EL DBTYPE
<cfquery name="qryResultado" dbtype="query">
SELECT NUM_MINISTRA, COUNT(*) AS TOTAL_REGISTROS, FLOOR (count(*)/12) as HOJAS_COMPLETAS FROM qryObtieneClaves
GROUP BY NUM_MINISTRA
</cfquery>
Me marca el siguiente error:
Error Executing Database Query.
Query Of Queries syntax error.
Encountered "(. Incorrect Select Statement, Expecting a 'FROM', but encountered '(' instead, A select statement should have a 'FROM' construct.
The error occurred in C:InetpubwwwrootpruebalineaqryRepCLC.cfm: line 70
68 :
69 : <!--- FLOOR((SELECT MAX(ROWNUM) FROM RF_TR --->
70 : <cfquery name="qryObtieneClaves" dbtype="query">
71 : SELECT NUM_MINISTRA, COUNT(*) AS TOTAL_REGISTROS, FLOOR(count(*)/12) as HOJAS_COMPLETAS FROM QRYCARGA_CLC
72 : GROUP BY NUM_MINISTRA
--------------------------------------------------------------------------------
SQL SELECT NUM_MINISTRA, COUNT(*) AS TOTAL_REGISTROS, FLOOR(count(*)/12) as HOJAS_COMPLETAS FROM QRYCARGA_CLC GROUP BY NUM_MINISTRA
Please try the following:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
¿ALGUIEN SABE COMO SOLUCIONAR ESTO?
Valora esta pregunta


0