query MySQL returns a different number of records of coldfusion and navicat

Hello

I hope someone can suggest a basic strategy to debug it.

I have a fairly large and complex question that is run by a function in a cfc.

(For example), it returns 100 rows.

If I use cfdump and then copy and paste the SQL of the query (with variables, of course) in Navicat and run exactly the same query on the same mySQL database, it returns 130 lines.

Even string SQL, the same database, same data - the only difference is that in one instance Navicat submits the request and in the other, Coldfusion doesn't.

Has anyone already had something like this happen before?

OK I found the bug mine. Of * course * sql queries were not identical... they might not. My mistake was thinking that they were.

The problem was part of the WHERE clause:

AND orderid in (500,503,505)

In the coldfusion code, it was

AND orderid in ()

which of course made in mySQL like AND orderid in ('500,503,505')

It was not immediately obvious that the cfdump that returns in the form AND orderid in (?) with the variable in the table below.

Tags: ColdFusion

Similar Questions

  • EqualLogic GroupManager displays a different number of replicas, 2 outgoing and incoming 1.

    GroupManager displays a different number of replicas, 2 outgoing and incoming 1.  Is this a normal behavior?

    I raise this question to technical assistance from Dell.  They checked with their lab environment and confirmed the same behavior.  There is no functional cause whose status is displayed like this.  Two points, they said:

    (1) the number of the line leaving includes the history of replication.   It will show you an extra line in addition to the number configured in the replica set. (in my case, it's 1 (configured) + 1 (extra), so 2 total)

    (2) the number of the replica by entering the real number of replica set used for the function of data redundancy.

  • Need help to write a MySQL query that returns only the peer matching records

    Because I don't know how to explain it easily, I use the table below as an example.

    I want to create a MySQL query that returns only the records that match counterparts where 'col1' = 'ABC '.

    Notice the ' ABC / GHI' record does not have a Counter-match ' GHI / ABC' record. This record must not be returned because there is no Counter-Party correspondent. With this table, the ' ABC / GHI' record should be the one returned in the query.

    How can I create a query that will do it?


    ID | col1 | col2
    --------------------
    1. ABC | DEF
    2. DEF | ABC
    3. ABC | IGS
    4. DEF | IGS
    5. IGS | DEF


    * Please let me know if you have no idea of what I'm trying to explain.

    I wanted to just the results where col1 = ABC, but I already got the answer I needed on another forum. Thank you anyway.

    SELECT a.col1,
    a.col2
    FROM table_name AS a
    LEFT OUTER
    Table_name JOIN b
    ON b.col1 = a.col2
    AND a.col1 = b.col2
    WHERE b.col1 IS NOT NULL AND a.col1 = 'ABC '.

  • A few keys return a different result example I press o and he returned .o

    My son has been on the computer (asus k53s) laptop. I don't know what he did, but now some of the traits keyboard return a different result, it feels almost like a kind of shortcut function. I restarted snd got the same result

    Here are the problems I found.
    o and. They all return two .o
    q returns a q and a tab
    m and refer my
    v and t both return a vt
    x starts the Help window
    I can't use my laptop properly right now that one of the letters is used in the passwd file, I use the keyboard to the mouse on screen.
    I need help asap thank you

    You can try the system restore to go back before the problem?

    How to repair the operating system and how to restore the configuration of the operating system to an earlier point in time in Windows Vista (or 7)
    http://support.Microsoft.com/kb/936212/#appliesTo

    I see that the OSK works for you, so perhaps the problem is a defective keyboard?  Have you tried to turn the laptop upside down and gently pat down to try to remove some of the bread crumbs between the keys (Lol).

    You can plug in another USB keyboard into the laptop and test with that?

  • OraDynaSet not returning the correct number of records.

    Hello everyone, I write the VB code in Excel 2007 and recovery of Oracle 9i data records. When I launch my application of TOAD or any other sql application I get 56 records returned for some queries. However, when I do from VB in excel and write the values to the excel file, it is not the 3 latest reviews, suggestions? Here's the part of my code:

    Worksheets ("Report"). Range ("a3"). Value = «»
    Worksheets ("Report"). Range ("B3"). Value = 'period '.
    Worksheets ("Report"). Range ("C3"). Value = 'Budget '.
    Worksheets ("Report"). Range ("D3"). Value = "projected."

    strSQL = "select GroupName, period_name, budget_value, budget_value nlas_bdgt_loading_stg project where to plant =" & plant & "and group_number = 1 order by group_number, period_num.

    Set OraDynaSet = objDataBase.DBCreateDynaset (strSQL, 0 &)

    If OraDynaSet.RecordCount > 0 Then

    OraDynaSet.MoveFirst
    "The recordset for the rows returned in a loop
    For i = 4-OraDynaSet.RecordCount
    ' Put the results in columns
    ActiveSheet.Cells (i, 1) = OraDynaSet.Fields (0). Value
    ActiveSheet.Cells (i, 2) = OraDynaSet.Fields (1). Value
    ActiveSheet.Cells (i, 3) is OraDynaSet.Fields (2). Value
    ActiveSheet.Cells (i, 4) = OraDynaSet.Fields (3). Value
    OraDynaSet.MoveNext
    Next I
    End If

    Thank you
    Chris

    Hello.

    For i = 4-OraDynaSet.RecordCount

    I believe that you start on the fourth record...

    Octavio

  • Query that returns number 1 - Add additional columns based on percentages

    I have a query that returns a large number.  The return value will always be a single field (a column, a line, a single value).

    I need to have also three other columns in the return of this request: one that returns a number that is 50% of the original number, one that returns a number that is 75% of the original number, and one that is double the original number.  How is that possible?  If anyone can point me to examples, it would be a great help.  I got the results mixed by searching, so I'm not sure good practices.

    Thank you for the input in advance.

    Hello

    Whenever you have a question, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the accurate results you want from this data, so that people who want to help you can recreate the problem and test their ideas.

    Explain, using specific examples, how you get these results from these data.

    If you show what you want to do using commonly available tables, like those of the scott schema, then you don't need to display the sample data; just results and explanations.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

    I'm not sure that understand the question.

    If x is a number, then

    .50 * x is 50% of this number,

    .75 * x is 75% of that number, and

    2 * x is to double this figure.

    You can get them all in the same query, if you want to.  For example:

    SELECT ename

    sal

    .50 * sal AS p_50

    .75 * sal AS p_75

    2 * sal AS dbl

    FROM scott.emp;

    Output:

    ENAME SAL P_50 P_75 DBL

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

    SMITH, 800, 400, 600, 1600

    1600 800 1200 3200 ALLEN

    1250 625 WARD 937,5 2500

    JONES 2975 1487.5 2231,25 5950

    1250 625 MARTIN 937,5 2500

    2850 1425 BLAKE 2137,5 5700

    2450 1225 CLARK 1837,5 4900

    3000 1500 2250 6000 SCOTT

    KING 5000 2500 3750 10000

    1500 750 1125 3000 TURNER

    1100 550 825 2200 ADAMS

    JAMES 950 475 712,5 1900

    FORD 3000 1500 2250 6000

    1300 650 975 2600 MILLER

    Is that what you ask?

  • difference in the number of records

    : The table DM_GBILL_STG_PERSON is my main table names containing 407052 records with field PERSON_ID, POSTAL_POST_CODE, POSTAL_CITY, Address1 address2.
    : Table DM_GBILL_SOU_PER_ADD_MAPP C is my temporary table that contains 113 records with ZIPCD, CITYCD domain names.

    Wat I have to do is return POSTAL_CITY as "BOMBAY" for

    So the first thing I have to do is to return POSTAL_CITY as "BOMBAY" for people whose postal_post_code in the table has to match with the zipcd in table C as I did in the Query1 by using A.POSTAL_POST_CODE = condition C.ZIPCD

    Second, I need to come back POSTAL_CITY like "BOMBAY" for people whose postal_post_code in the table does not correspond with the zipcd in table C that I made in the Query2.For what I hv used an A.POSTAL_POST_CODE condition! = C.ZIPCD and concatenated address1 and address2 to find the name of the city of temporary table C and its corresponding zipcd back and placing it in a table of POSTAL_ Class POST_CODE.

    So, the problem is that Query1 returns the correct number of records but Query2 returns records that are also present in Query1:

    Can anyone of you please suggest a solution.

    Query 1:

    SELECT A.PERSON_ID,
    (CASE
    WHEN A.POSTAL_POST_CODE = C.ZIPCD
    THEN "BOMBAY".
    ELSE 'MOMMY '.
    END) AS POSTAL_CITY
    OF DM_GBILL_STG_PERSON,.
    C DM_GBILL_SOU_PER_ADD_MAPP
    WHERE A.POSTAL_POST_CODE = C.ZIPCD

    Query 2:

    SELECT A.PERSON_ID, C.ZIPCD AS POSTAL_POST_CODE
    OF DM_GBILL_STG_PERSON,.
    C DM_GBILL_SOU_PER_ADD_MAPP
    WHERE
    SUBSTR (UPPER (A.ADDRESS1 |)) A.ADDRESS2), INSTR (UPPER(A.ADDRESS1 ||) (A.address2), C.CITYCD), length (Upper (C.citycd))) = Upper (C.CITYCD)
    AND INSTR(A.ADDRESS1 ||) A.address2, C.CITYCD) > 0
    AND A.POSTAL_POST_CODE! = C.ZIPCD

    Hello (and welcome)

    I don't know how this can be the case, but this should not return records that exist in the first query:

    SELECT A.PERSON_ID,C.ZIPCD AS POSTAL_POST_CODE
    FROM DM_GBILL_STG_PERSON A,
    DM_GBILL_SOU_PER_ADD_MAPP C
    WHERE
    SUBSTR(UPPER(A.ADDRESS1||A.ADDRESS2),INSTR(UPPER(A.ADDRESS1 ||A.ADDRESS2),C.CITYCD),LENGTH(UPPER(C.citycd)))=UPPER(C.CITYCD)
    AND INSTR(A.ADDRESS1 ||A.ADDRESS2,C.CITYCD)>0
    AND NOT EXISTS (
      SELECT 1
       FROM DM_GBILL_STG_PERSON A2,
      DM_GBILL_SOU_PER_ADD_MAPP C2
      WHERE A2.POSTAL_POST_CODE=C2.ZIPCD
         AND A.PERSON_ID = A2.PERSON_ID)
    
  • Definition of different number of REB for each key

    Hello

    Assuming I have the following tables and sample data:

    create table test_tbl_aa
    (aa number(2));
    
    insert all into test_tbl_aa(aa) values(aa)
    select level aa
       from dual
       connect by level<=4;
       
    create table test_tbl_aa_n
    (aa number(2), n number(1));
    
    insert all into test_tbl_aa_n(aa, n)
      select aa, lv
        from test_tbl_aa
        cross join (select level lv
                    from dual
                    connect by level<= trunc(dbms_random.value(1,3))
                    ) v;
    

    For example, running the stmt insert in the table test_tbl_n the inserted rows are:

    AA    N
    --------
    1     1
    1     2
    2     1
    2     2
    3     1
    3     2
    4     1
    4     2
    

    In the example above defined result a stable set of records for each aa (for each series).

    Is it possible to generate different number or records in the table for each data value test_tbl_n

    column aa?

    For example for:

    AA    N
    --------
    1     1
    1     2
    2     1
    3     1
    4     1
    4     2
    

    Note: Oracle db 11g. v2

    Thank you very much

    SIM

    Do you mean like this?

    SQL > insert while test_tbl_aa_n (aa, n)
    2 Select aa, level
    test_tbl_aa 3
    4. connect by level<=>
    5 and aa = aa prior
    sys_guid() 6 and prior is not null
    7.

    6 rows created.

    SQL > select * from test_tbl_aa_n;
    AA N
    ---------- ----------
    1          1
    1          2
    2          1
    2          2
    3          1
    4          1

    6 selected lines.

  • Query should return the number of records that do not match the values of the DB

    I have the SQL query in the IN clause that I have certain values to verify each year against DB. I need a query that should tell the number 1 for existing records and 0 to not exist records. I get only matched lines from now account. Help is very appreciated.

    sample

    number of values
    SAM 1
    CAT 0
    POOL 1
    JACK 1
    FUN 0


    Concerning
    Prakash.
    with search_for_values as (
    select 'SAM' name from dual
    union all select 'CAT' from dual
    union all select 'HEN' from dual
    union all select 'JACK' from dual
    union all select 'FUN' from dual
    )
    , search_in_tab as (
    select 'SAM' name from dual
    union all select 'HEN' from dual
    union all select 'JACK' from dual
    union all select 'HEN' from dual
    union all select 'JACK' from dual
    union all select 'HEN' from dual
    union all select 'JACK' from dual
    )
    select sfv.name
         , case when exists ( select null from search_in_tab sit where sit.name = sfv.name  ) then 1 else 0 end   cnt
    from search_for_values sfv
    

    Anton

  • Query does not return number of records

    Hi guys,.

    Is someone can you please tell me why this query will not retrieve the correct number of records.
    I have a table with six users

    FIRST NAME LAST NAME
    David Robert
    Martin sinner
    Henry Robert King
    Edmund Tomkinson
    Robert Hayes Williams
    Tina Belkins

    When I run a query, SELECT * of USERS WHERE LAST_NAME LIKE "Robert."
    I get only 1 card back (David Robert). Is the space between the family name
    the cause? If so, how can I rewite the query?

    '%', Missing perhaps before and after the search string depending on what you want to find.

    SELECT * FROM USERS WHERE LAST_NAME LIKE '%Robert%';
    
  • Can I get the total number of records that meet the conditions of a query using the Table API?

    Hello

    A < row > TableIterator is returned when I ask operations using the index of tables. If I want to get the total number of records, I count one by one using the returned TableIterator < row >.


    Can I get the total number of records directly meets the conditions of the query?

    I can get the total number of records directly the request of the meeting of the conditions of CLI using the command Global table - name tableName - count - index index-name-field fieldName - start startValue-end endValue.

    Can I get the same results using the Table API?

    I used MongoDB and NoSQL Oracle for about a year. According to the experience of the use of these dbs, I think mongoDB querying interface is powerful. In the contras, the query interface is relatively simple, which results is a lot of work that is usually a long time in the client side.

    Hello

    Counting records in a database is a tricky thing.  Any system that gives you an accurate count of the records will have a hotspot of concurrency on updates, namely the place where the counting is maintained.  Such a count is a problem of performance in addition to competitive access problem.   The problem is even more difficult in a system widely distributed such a NoSQL database.

    The CLI has overall command that counts, but does so by brutal force - iterate keys that correspond to the parameters of the operation.  This is how you must do this within the API.  There is not a lot of code, but you have to write.  You certainly want to use TableIterator TableAPI.tableKeysIterator (), because a key iteration is significantly faster than the iteration of lines.  Just one iteration and count.

    If you use TableAPI.multiGet () and a key with a touch of brightness full then, in fact, count the results as they are returned in a single piece (a list).

    Kind regards

    George

  • Returns the number of records

    IM under the sub query, it returns the number of records, but how can I count the number of records is reurning?

    I use version 12.0.0.61 (toad for oracle)

    Thank you

    Select * from object

    where owner = 'FIRST '.

    AND OBJECT_TYPE = 'FUNCTION '.

    AND OBJECT_NAME LIKE '% FDR_ % '.

    If you want just the County

    select count(*)
      from all_objects
     where owner='PREMIER'
      AND OBJECT_TYPE='FUNCTION'
      AND OBJECT_NAME LIKE'%FDR_%'
    

    If you want the number on each line in addition to the line-level data

    select a.*, count(*) over () cnt
      from all_objects a
     where owner='PREMIER'
      AND OBJECT_TYPE='FUNCTION'
      AND OBJECT_NAME LIKE'%FDR_%'
    

    Justin

  • Copy from HDD to disc results external hard of different sizes but the same number of records

    Backup hard drive to external drive, 800 GB in total. When finished copying the file on the external drive size is smaller than 40 GB, but there is the same number of records.

    Different disks often present of thisdue fragmentation on each disk and the differences in the block sizes used on each disc. As long as all your data are present then there is no need to worry.

  • Query to get the number of records

    Hi all

    I would get the number of records in all tables in a schema. I don't want to run select count (*) of < table name >, because there are nearly 400 paintings. So I need a generic quqeyr that will give the recordcount for all tables.

    Experts good help yourslef to tide me over.

    Do you need a specific account? Or an approximate count is sufficient? Do you use the RBO and CBO?

    If you use the CBO and want an approximate count, column NUM_ROWS USER_TABLES should give you what you want.

    If you need a specific account, you will have full scan all tables. You can automate this process via SQL dynamic, i.e.

    DECLARE
      l_cnt INTEGER;
    BEGIN
      FOR x IN (SELECT table_name FROM user_tables)
      LOOP
        EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || x.table_name INTO l_cnt;
        dbms_output.put_line( 'Table ' || x.table_name || ' has ' || l_cnt || ' rows.' );
      END LOOP;
    END;
    

    Lawrence was also a [solution based on XML Query | http://laurentschneider.com/wordpress/2007/04/how-do-i-store-the-counts-of-all-tables.html] to count all the rows in each table in a schema.

    Justin

  • same query returns results different game

    Hi all
    I use 10g db.
    I have a query as below
      SELECT SUM(EID_AMOUNT)amt,EID_INCR_CODE,EIH_EFF_DATE
         FROM EMP_INC_HEADER,EMP_INC_DETAILS
        WHERE EIH_EMP_CODE = EID_EMP_CODE
          AND EIH_EFF_DATE = EIH_EFF_DATE
          AND EIH_STATUS   = 'P'
          AND EID_EMP_CODE = '003848'
     GROUP BY EID_INCR_CODE,EIH_EFF_DATE
     ORDER BY EID_INCR_CODE,EIH_EFF_DATE;
    that leads to the exit
          AMT EID_INCR_CODE   EIH_EFF_D
    --------- --------------- ---------
         2000 BASIC           21-SEP-10
         2000 BASIC           23-SEP-10
         2000 BASIC           15-OCT-10
         2000 BASIC           21-OCT-10
         1200 HTRAN           21-SEP-10
         1200 HTRAN           23-SEP-10
         1200 HTRAN           15-OCT-10
         1200 HTRAN           21-OCT-10
          800 OTHERS          21-SEP-10
          800 OTHERS          23-SEP-10
          800 OTHERS          15-OCT-10
          800 OTHERS          21-OCT-10
    I have question
    SELECT SUM(EID_AMOUNT)amt,EID_INCR_CODE,EID_EFF_DATE
     FROM EMP_INC_HEADER,EMP_INC_DETAILS
     WHERE EIH_EMP_CODE = EID_EMP_CODE
     AND EIH_EFF_DATE = EID_EFF_DATE
     AND EIH_STATUS = 'P'
     AND EID_EMP_CODE = '003848'
     GROUP BY EID_INCR_CODE,EID_EFF_DATE
     ORDER BY EID_INCR_CODE,EID_EFF_DATE;
    leading to 
    
          AMT EID_INCR_CODE   EID_EFF_D
    --------- --------------- ---------
          500 BASIC           21-SEP-10
          500 BASIC           23-SEP-10
          500 BASIC           15-OCT-10
          500 BASIC           21-OCT-10
          300 HTRAN           21-SEP-10
          300 HTRAN           23-SEP-10
          300 HTRAN           15-OCT-10
          300 HTRAN           21-OCT-10
          200 OTHERS          21-SEP-10
          200 OTHERS          23-SEP-10
          200 OTHERS          15-OCT-10
          200 OTHERS          21-OCT-10
    
    12 rows selected.
    second request is back is correct. as shown in the table.
    but my question what is the difference between my first and second query.
    What's different (I don't get any idea).
    If one is to have an idea please share it with me.

    Thank you...

    GD says:

    SELECT SUM(EID_AMOUNT)amt,EID_INCR_CODE,EIH_EFF_DATE
    FROM EMP_INC_HEADER,EMP_INC_DETAILS
    WHERE EIH_EMP_CODE = EID_EMP_CODE
    AND EIH_EFF_DATE = EIH_EFF_DATE
    AND EIH_STATUS   = 'P'
    AND EID_EMP_CODE = '003848'
    GROUP BY EID_INCR_CODE,EIH_EFF_DATE
    ORDER BY EID_INCR_CODE,EIH_EFF_DATE;
    

    Salvation;
    Why the following criteria exist in the query?

    AND EIH_EFF_DATE = EIH_EFF_DATE
    

    Kind regards
    Mennan

Maybe you are looking for