Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Re: Query of queries

    I think that we're using 5 on both environments (not checked that though - they
    shouldn't be different anyway)... It seems that i've fixed it... notes below:
    main query (getall) SELECT * FROM tableName WHERE ID=#variables.nId# query of
    queries SELECT * FROM getall WHERE TYPE='TITLE' The only difference being that
    the bottom query doesn't reference the columns by name in the select, just uses
    the asterix to catch all. Im trying think of a logical explanation to this but
    nothings arrived at my head yet... :)

    restlessmedia Guest

  2. Similar Questions and Discussions

    1. Need Help with Query of Queries
      I have the query "almost" there but I'm not sure exactly how to accomplish this. I need all recrods meeting the criteria from the AppliedLicense...
    2. 2 queries to 1 query
      Hello, Can somebody help me to combine these two queries into one query. <cfquery datasource="#DATAS#" name="getMainNav"> SELECT * FROM...
    3. Query of Queries in 7.0
      I am running MX 6.1 and was wondering of the QofQ problem still exists (in the new version, 7.0) where CF tries to guess at the column datatype...
    4. Query of Queries on query New type query
      In CF5 we have a page that creates a query, using queryNew and querySetCell and the like, we then used dbtype="query" and gave it's name so we could...
    5. Query of Queries?
      I have a table named therapists with a field named modalities which contains a comma delimited list of id #s. I need to loop through a list of...
  3. #2

    Default Query of Queries

    Moving from 6.1 to 7 and have a page the makes use of query of queries. Works
    fine in 6.1 but getting the following error in 7:

    Query Of Queries runtime error.
    Comparison Exception: While executing "="
    Unsupported Type Comparison Exception: Comparator operator "=" does not
    support comparison between following types:
    Left hand side expression type = "STRING".
    Right hand side expression type = "NULL".

    Any ideas on how to fix this?


    KRIKAT Guest

  4. #3

    Default Re: Query of Queries

    You didn't post your code, but you should be using IS NULL or IS NOT NULL instead of = NULL or <> NULL respectively when attempting to determine if a column has a NULL value or not.

    Phil
    paross1 Guest

  5. #4

    Default Re: Query of Queries

    I'm not comparing for Null values as that is the error message I get from CF.
    Below is the query that joins two other CF queries. In 6.1 there was no problem
    but 7 is causing the error.

    <cfquery name="account" dbtype="query">
    select * from account, accountx where account.account_id=accountx.account_id
    and account.period=accountx.counter
    order by gl_type, account_id
    </cfquery>

    KRIKAT Guest

  6. #5

    Default Re: Query of Queries

    When using Query of Queries, you have to explicitly test comparison values for
    NULL, otherwise you will get the error you are seeing.

    <cfquery name="account" dbtype="query">
    select *
    from account, accountx
    where account.account_id = accountx.account_id and
    accout.period is not null and
    accountx.counter is not null and
    account.period=accountx.counter
    order by gl_type, account_id
    </cfquery>

    Also note that comparisons are case sensitive, so if you care comparing values
    to CF variables, you need to convert the variable and column value to either
    uppercase or lowercase.

    where upper(table.col ) = #UCase(cfvar)#

    sthompson Guest

  7. #6

    Default Query of Queries

    Hi. I am running a Query of Queries to save processor.

    Its working great when there is nothing complex:


    --------------------------------------------------------------------------------
    ---------------------
    <cfquery name="Logs" datasource="mydatasource" username="myusername"
    password="mypassword" cachedwithin="mytime">
    select cip,date
    from logs
    </cfquery>

    then a query of that query:

    <cfquery name="LogsByTime" dbtype="query">
    select *
    from logs
    </cfquery>


    --------------------------------------------------------------------------------
    ---------------------

    But, when I try to add functions in there it errors...

    All of the following cuase a problem:

    <cfquery name="LogsByTime" dbtype="query">
    select distinct([time_format( time, '%H' )]) as d, cip
    select cip,date
    from logs
    group by d
    </cfquery>

    <cfquery name="LogsByTime" dbtype="query">
    select distinct([time_format( time, '%H' )]) as d, cip
    select cip,date
    from logs
    group by [d]
    </cfquery>

    <cfquery name="LogsByTime" dbtype="query">
    select distinct([time_format( time, '%H' )]), cip
    select cip,date
    from logs
    group by 'time'
    </cfquery>


    Can anyone help me?

    M@)


    game_on Guest

  8. #7

    Default Query of Queries

    I'm trying to run a query that gives me the account number in a table if the
    first three characters of an identifer are greater than or equal to 055. For
    example if the identifier was 000054321 then this would not pass but 000055321
    would. The leading zeros are pads to have a large range of numbers so there
    will be a variable amount of them to begin the identifier. I would like to
    parse these identifiers in coldfusion as opposed to trying to do it in SQL.
    The only thing is i have to have access to these variables prior to running the
    querythat checks the numbers. Is there a simple approach to this? Perhaps a
    query to get all the values of the table, then use those results to parse the
    identifier and query the table again? I need the final output in query form so
    I can pass it to the coldfusion report builder Thanks for the help.

    -jared

    Jared@Itron Guest

  9. #8

    Default Re: Query of Queries

    If you can cast these strings to an integer in your original query, it might solve all your problems.
    Dan Bracuk Guest

  10. #9

    Default Re: Query of Queries

    Because QofQ does not have substring operators, you cannot use QofQ by itself
    to do this.

    You must either loop through the Q results and churn (NOT recommended) or you
    must do some of the work in your original query.

    For example, if the original column is integer, then add another line to your
    first select statement like this:
    SELECT
    ...
    LEFT (CAST (ORIGINAL_COLUMN AS varchar (88), 2) AS sIdentifier
    ...

    (Syntax shown is for MS SQL server but the same thing works, with minor tweaks
    in most RDBM's.)

    If the original column is not an integer then additional operations are needed
    -- details depend on what's really in the original column.

    Then, later you can do a Q of Q that has WHERE CAST (sIdentifier AS Integer)
    >= 55

    MikerRoo Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139