Discussion:
Query of Query
(too old to reply)
TommyMTL
2009-03-06 15:12:35 UTC
Permalink
HI, I have a query :
<cfquery name="LocationDataDisplay" datasource="IMV1">
SELECT ID, Cat_ID, Categorie, CategorieB, CategorieC, FR_Info, FR_Tag,
EN_Info, EN_Tag, List, Active
FROM LocationData
<cfif IsDefined ("URL.C") is true>
WHERE Active = 'true' and Cat_ID = '#URL.Loc#' and Categorie = '#URL.C#' and
[b]List LIKE '%#URL.SC#%'[/b]
</cfif>
ORDER BY FR_Tag ASC
</cfquery>

That I want to change for a query of query but my [b] List LIKE '%#URL.SC#%'
[/b] is not working, I tried contains but not working... ?

<cfquery dbtype="query" name="LocationDataDisplay">
SELECT ID, Cat_ID, Categorie, CategorieB, CategorieC, FR_Info, FR_Tag,
EN_Info, EN_Tag, List, Active
FROM LocationData
<cfif IsDefined ("URL.C") is true>
WHERE Active = 'true' and Cat_ID = '#URL.Loc#' and Categorie = '#URL.C#' and
List LIKE '%#URL.SC#%'
</cfif>
ORDER BY FR_Tag ASC
</cfquery>


How should I write it?
Azadi
2009-03-06 15:34:14 UTC
Permalink
what do you mean by 'not working'?

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
TommyMTL
2009-03-06 15:51:58 UTC
Permalink
It create an error!

here it is:
Error Occurred While Processing Request
The system has attempted to use an undefined value, which usually indicates a
programming error, either in your code or some system code.
Null Pointers are another name for undefined values.

It look like the [b]List LIKE '%#URL.SC#%'[/b] generate an error of some kind!
GArlington
2009-03-06 16:16:20 UTC
Permalink
Post by TommyMTL
It create an error!
 Error Occurred While Processing Request
 The system has attempted to use an undefined value, which usually indicates a
programming error, either in your code or some system code.
 Null Pointers are another name for undefined values.
 It look like  the [b]List LIKE '%#URL.SC#%'[/b] generate an error of some kind!
Are you sure that your url.sc is defined?
Are you using existing query (that you got from DB) as input to your
QoQ?
Dan Bracuk
2009-03-06 17:03:40 UTC
Permalink
That's not it. Do you have a query named LocationData?
TommyMTL
2009-03-06 18:33:58 UTC
Permalink
Well, if it is not it, I have no ideas on what can create the error because if
I turne the entier query to a simple query request with that code everything is
fine and I get result back

If I turn the query into a query of query the same

LIKE '%xxx%' generate the error, If I remove that part only, query of query
is fine!

So in other words, the "LIKE" is my problem
Dan Bracuk
2009-03-06 18:39:45 UTC
Permalink
What is the select clause for the query, locationdata?
Adam Cameron
2009-03-06 23:50:46 UTC
Permalink
Post by TommyMTL
<cfquery name="LocationDataDisplay" datasource="IMV1">
SELECT ID, Cat_ID, Categorie, CategorieB, CategorieC, FR_Info, FR_Tag,
EN_Info, EN_Tag, List, Active
FROM LocationData
<cfquery dbtype="query" name="LocationDataDisplay">
SELECT ID, Cat_ID, Categorie, CategorieB, CategorieC, FR_Info, FR_Tag,
EN_Info, EN_Tag, List, Active
FROM LocationData
Don't you mean "LocationDataDisplay" rather than "LocationData" in that
second query?
--
Adam
Loading...