Skip to main content
Inspiring
March 6, 2009
Question

Query of Query

  • March 6, 2009
  • 7 replies
  • 910 views
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 List LIKE '%#URL.SC#%'
</cfif>
ORDER BY FR_Tag ASC
</cfquery>

That I want to change for a query of query but my List LIKE '%#URL.SC#%' 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?
This topic has been closed for replies.

7 replies

Participant
March 11, 2009
may be it is due to url parameters having null values...
Inspiring
March 6, 2009
> <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
Inspiring
March 6, 2009
What is the select clause for the query, locationdata?
TommyMTLAuthor
Inspiring
March 6, 2009
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
Inspiring
March 6, 2009
That's not it. Do you have a query named LocationData?
TommyMTLAuthor
Inspiring
March 6, 2009
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 List LIKE '%#URL.SC#%' generate an error of some kind!
Inspiring
March 6, 2009
what do you mean by 'not working'?

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/