csierra
Posts: 123
|
| Posted: 12/25/2006, 2:46 PM |
|
Hi everyone! I need help as follows, my db is MS Jet 4.0, have 1 table called tbContenidos and a query called qryContenidos, that´s all I have in my db. Now, I have a inner relation within this one table tbContenidos, have a primary key (IdC) and a second column called IdP, wich stands for IdParent... IdP points to the same table, constraint to IdC. What is *NOT* working in CCS 3.1 is using, or pretend to use a URL variable in the subquery.
The following SQL statement is used as a datasource for a simple grid component
Let me show: this works
SELECT qryContenidos.IdC, qryContenidos.IdP, qryContenidos.PrePath, qryContenidos.Fecha_creacion, qryContenidos.Nombre, qryContenidos.Titulo_corto, qryContenidos.Titulo_largo, qryContenidos.Intro, qryContenidos.Articulo, qryContenidos.Nota, qryContenidos.img_Menu, qryContenidos.img_Thumb, qryContenidos.img_Arte, qryContenidos.link_pc_od, qryContenidos.link_pc_dd, qryContenidos.link_c_od, qryContenidos.link_c_dd, qryContenidos.vd, qryContenidos.vh
FROM qryContenidos
WHERE (qryContenidos.IdP=(SELECT tbLookForIdP.IdP
FROM tbContenidos AS tbLookForIdP
WHERE tbLookForIdP.IdC=14 AND tbLookForIdP.IdP Is Not Null))
However, what I need and does *not* work is:
SELECT qryContenidos.IdC, qryContenidos.IdP, qryContenidos.PrePath, qryContenidos.Fecha_creacion, qryContenidos.Nombre, qryContenidos.Titulo_corto, qryContenidos.Titulo_largo, qryContenidos.Intro, qryContenidos.Articulo, qryContenidos.Nota, qryContenidos.img_Menu, qryContenidos.img_Thumb, qryContenidos.img_Arte, qryContenidos.link_pc_od, qryContenidos.link_pc_dd, qryContenidos.link_c_od, qryContenidos.link_c_dd, qryContenidos.vd, qryContenidos.vh
FROM qryContenidos
WHERE (qryContenidos.IdP=(SELECT tbLookForIdP.IdP
FROM tbContenidos AS tbLookForIdP
WHERE tbLookForIdP.IdC=varIdC AND tbLookForIdP.IdP Is Not Null))
Please note that where it says varIdC I have tried [@IdC], @IdC, IdC and accordingly have set the options in the SQL editor to match varIdC to a URL parameter, unsuccessfully.
Please note that both work on MS Access and plain ASP, so there is no pittfall in my SQL
Any ideas are very very much appreciated
Thanks
Carlos
_________________
Yes! I Can!!! |