Search code examples
sqlcoldfusionqoq

Query on free text field


EDIT:
Actually, I run MSSQL query, let say the result is:

ID  pagename
1   1
2   01
3   01, 15

Then, I run another command URL and got the result as xml data, let say the result (in simple form) is:

4   01, 01 Aaa, 15
5   02
6   03
7   100
8   101
9   115

Using coldfusion, I can merge both data into one "temporary table". So, actually, I am using a QoQ and not a database query
END EDIT

I have a table like this

ID  pagename
1   1
2   01
3   01, 15
4   01, 01 Aaa, 15
5   02
6   03
7   100
8   101
9   115

Is it possible if I want to show pagename = 1 the result is

ID  pagename
1   1
2   01
3   01, 15
4   01, 01 Aaa, 15

Solution

  • I think that you will have better luck with programming code than query of queries. My approach would resemble this:

    <cfset NewQuery = QueryNew("id,pagename","integer,varchar")>
    <cfloop query = "ExistingQuery">
      <cfif ListFirst(pagename) EQ 1>
        code to add row and set cell values for NewQuery
      </cfif>
    </cfloop>
    

    Note to those reading on the sql page, this is an earlier comment: "@MahmoudGamal sorry, I'm using Coldfusion function QueryNew to create temporary table"

    In other words, it's not a database query.