CF8 cfquery multiple table join with the same names of columns - default

This seems to be a defect in the CF8 cfquery object. I'm at a loss as to a solution or a good work around. With regard to the substance, this query is generated dynamically on the fly based on what is happening in it a user. This isn't the most elegent SQL but work and return all columns. The app itself is a data viewer to look at the logs. Here is an example of a query being generated.

Select *.

of web_trans, web_info_trans, web_res_trans

where (web_info_trans.trans_dte > = '' 2008-12-1)

and web_info_trans.trans_dte < '' 2008-12-2)

and (web_info_trans.trans_dte = web_trans.trans_dte)

and (web_info_trans.trans_num = 5060345)

and (web_info_trans.trans_num = web_trans.trans_num)

and (web_res_trans.trans_num = 5060345)

and (web_res_trans.trans_num = web_trans.trans_num)

and (web_trans.web_trans_cde = "NTUI")

and (web_trans.web_status_cde = 'P')

and (web_trans. TRANS_NUM < 5060347)

order of web_trans. TRANS_NUM / / desc

These three tables contain a similar column called ZIP_CDE. They contain different values, and when this query is executed in Microsoft Query Analyzer results are displayed correctly. Run this same query SQL with CFQUERY and the value of one of the other tables (web_trans) will eventually replace the value for the other columns called ZIP_CDE. The exact amount columns are retruned only values some how get corrupted.

This is a defect of cf8 is a book autour or an update that resolves this problem that I may have missed?

Thank you for the ideas.

Thus it seems still as a default since CF is essentially where, except for the return value play. Other query tools return results correctly so for me, it turns out be CF bug at a certain level.

Actually I'm swinging to agree with you here, but not for the same reason.  CF actually * is * get all the columns back (as you say), it just doesn't expose a way to tell the difference between a column called 'x' and an another column called 'x', because the way to access the data in columns is simple queryname [columnName] [rowNumber] (or a Variant fo this, but all the amount of variations to that or abbrev. it).  This code shows how he has all four columns of the original two queries (being a stand-in for tables, in this case):


Q1 = queryNew("");
Q2 = queryNew("");
   
queryAddColumn (q1, 'id', [1,2,3,4]);
queryAddColumn (q1, "data", ["one", "two", "three", "four"]);
queryAddColumn (q2, 'id', [1,2,3,4]);
queryAddColumn (q2, "data", ["tahi", "rua", "toru", "wha"]); It's Maori, in case you are interested


SELECT *.
Q1, q2
WHERE q1.id = q2.id

So CF knows there are four columns (a call getMetadata (q3) get also demonstrates this), but it does not expose a way to approach the second (or even greater) column of the same name.  This is the bug/shortfall.

However, relying on an underlying coldfusion.sql.QueryTable method, you can rename the columns, so:

Then you're OK.

I would be normally reluctant to recommend doing this, because these methods change from version to version of CF, but it's your call whether this approach will help you.

To be honest, I'm with Owain who, even in SQL one generally doesn't work with columns with the same name, an alias them qualified with a table name/alias. As the table columns from of is not returned by SQL with the result set, it must be evidence against this by folding the columns in the first place.

Also, I wonder at the bottom of the extraction of data, you don't really know the structure, that is to say, do SELECT *.  How can you know not even that is ours as the first column, second column, etc.?  I don't think that SQL applies in fact a contract that, t - it?  (I don't know).

What are you actually do here?

--

Adam

Tags: ColdFusion

Similar Questions

  • How to export data to excel that has 2 tables with the same number of columns and the column names?

    Hi everyone, yet once landed upward with a problem.

    After trying many things to myself, finally decided to post here...

    I created a form in form builder 6i in which clicking on a button, the data gets exported to the excel sheet.

    It works very well with a single table. The problem now is that I cannot do the same with 2 tables.

    Because the tables have the same number of columns and the columns names.

    Here are the 2 tables with column names:

    Table-1 (MONTHLY_PART_1) Table-2 (MONTHLY_PART_2)
    SL_NOSL_NO
    MODELMODEL
    END_DATEEND_DATE
    U-1U-1
    U-2U-2
    U-4U-4
    ..................
    ..................
    U-20U-20
    U-25U-25

    Given that the tables have the same column names, I get the following error :

    402 error at line 103, column 4

    required aliases in the SELECT list of the slider to avoid duplicate column names.

    So how to export data to excel that has 2 tables with the same number of columns and the column names?

    Should I paste the code? Should I publish this query in 'SQL and PL/SQL ' Forum?

    Help me with this please.

    Thank you.

    Wait a second... is this a kind of House of partitioning? Shouldn't it is a union of two tables instead a join?

    see you soon

  • It is possible to have two tables with the same name in Oracle!

    Oracle Version: 10 gr 2

    MS Access 2007, I had to use the 'Export' by which I copy a table (and its data) to an Oracle schema via an ODBC connection. Later, I realized that, during the copy of tables with a mix of lower and upper case names, the table does not copied (exported). But MS Access will give you the message that table obtained export successfully.

    MS-Access mess around Oracle data dictionary.

    When you issue
    SQL>select * from tab;
    
    TNAME                          TABTYPE  CLUSTERID
    ------------------------------ ------- ----------
    AMStates                       TABLE
    Version                        TABLE
    You will see the names of the tables. But when you try to DESCRIBE or SELECT this table, you will
    SQL>desc Version
    ERROR:
    ORA-04043: object Version does not exist
    You can even create another table with the same name in the schema
    SQL>create table VERSION (X NUMBER);
    
    Table created.
    Why this is happening and how can I bring these items 'non-existent '?

    Hello

    Use

    SQL > desc 'Version '.

    Or

    SQL > select * from 'Version '.

    Or

    SQL > drop table 'Version '.

    To overcome the problems of mixed-case.

  • Create a schema of the user with the same name and tables within this scheme

    I am a newbie with Oracle.
    I installed my first Oracle 10 g database in my life.
    I need to create a user and a new schema with the same name.
    Subsequently, I need to create tables in this schema using the * isqlPlus.
    I got to create the user via the Oracle Enterprise Manager Console.
    I tried to create a schema through the same tool, but I have not found a possibility to do using GUI.
    Is it possible to do so through Oracle Enterprise Manager Console?
    What are the permissions the user must have access isqlPlus to create the tables in the schema?

    Thank you!!!

    Felipe

    A schema is just a collection of objects belonged to a particular user. If you do not need to create a separate schema: the schema is created automatically when you create the user.

    To connect to the database, a user must CREATE SESSION privilege. To create a table, the user has the CREATE TABLE privilege and should be given a quota on any tablespace will be created in the table. If you don't care management quota or limit the storage space that a user can create tables, you can grant the user the UNLIMITED TABLESPACE privilege. If you care the management of quota, you must run commands like

    ALTER USER <>
      QUOTA <>
      ON <>
    

    for each tablespace for the user to be able to use.

    Justin

  • [.ini files] Get the value of multiple labels with the same name

    Hello!

    In an ini.files, I need to get the value of each tag named in a certain way in a section, but unfortunately, I have 3 or 4 tags with the same name in several sections. I don't know how to retrieve these values, the program always consider that the first tag and not others, I tried to remove each tag after obtaining its values, that he did not.

    Does anyone have an idea to solve the problem?

    Thank you!

    As you can read in my last post, you must read and throw 'x' lines:

    OpenFile)

    Skip lines

    for (i = 0; i< x;="" i++)="" readline="">

    Start reading the useful lines

    ReadLine () / / read a line

    ... / / Interpret the line

    Don't forget to add a control during i/o operations of robust error and to check the end of the file.

  • How to register multiple files with the same name with different num revision

    Hello

    Can someone please tell me, how to register several different files with the same name with the revision number using the RIDC API.

    For example:
    First of all I will be saved in a file (TestFile.txt) in a content server with revision number 1 using the RIDC API in application of the ADF. Then after awhile, will change the same line (TestFile.txt) check-in and once again. I tried to check the same file several times, however first Check-in correctly in server showing revision 1, so that Check-in same file again, her gives no error message, and also its not reflecting only not to the server. Single file (TestFile.txt) reflecting on the server.

    How to implement this feature using the RIDC API? Any suggestions would be helpful.

    Concerning
    REDA

    Published by: 887680 on March 6, 2013 10:48

    (1) get the content ID (dDocName), call CHECKOUT_BY_NAME
    (2) call check-in service with dRevLabel = previous dRevlabel + 1

  • several devices on the network with the same name

    I want to install Windows 7 OS computers on a domain with Small Business SERVER 2003.  Curiously, I see all the computers on the network, where I should be able to, but one of them WK02011, is not accessible from all Windows 7 systems because there are multiple devices with the same name on the network according to a diagnosticn check.  WK02011 is visible and accessible from other systems on the network that are runjning XP OS.  There is only one device named WK02011 on the network.  I don't have this problem with any other XP system - that is - I can see and access all of the other XP machines on the network with the exception of WK02011.  I can't access WK2011 from the server and the server indicates that it is multiple devices with the same ID.  Rename the XP would be complicated because of having to re - set up the service to the customer and then turn around and install 7 OS in the workstation in the coming days.

    How to find the ghost device double?

    Hello

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for Windows 7 on TechNet. Please post your question in the Technet forums. You can follow the link to your question:

  • Two objects with the same name

    Hi all

    In my production database, there is a materialized view and a table with the same name. The two objects have the same number and type of columns.

    Record from user_object table

    OBJECT_NAMESUBOBJECT_NAMEOBJECT_IDDATA_OBJECT_IDOBJECT_TYPECREATEDLAST_DDL_TIMETIMESTAMPSTATUSTEMPORARYGENERATEDSECONDARYNAMESPACEEDITION_NAME
    TEST_OBJ151373151373TABLE22/06/201222/06/20122012-06 - 22:15:39:30VALIDNNN1
    TEST_OBJ152287MATERIALIZED VIEW22/06/201208/03/20122012-06 - 22:16:08:46VALIDNNN19

    I have another mode to normal display, TEST_NORMAL_VIEW, which selects the data of TEST_OBJ.

    Then, on which table data select. Please give some input on this subject.

    Kind regards

    Matondo

    A materialized view has 2 objects internally for her

    1. the materialized view (it is more of a model)

    2. the table that stores the actual data.

    So when you create a materialized view, you can see 2 objects created by querying the USER_OBJECTS.

    See this

    SQL> create materialized view my_test_mv as select * from emp;
    
    Materialized view created.
    
    SQL> select object_type, object_name, data_object_id from user_objects where object_name = 'MY_TEST_MV';
    
    OBJECT_TYPE        OBJECT_NAME          DATA_OBJECT_ID
    ------------------- -------------------- --------------
    TABLE              MY_TEST_MV                  1638964
    MATERIALIZED VIEW  MY_TEST_MV
    

    Now, you may notice that DATA_OBJECT_ID has null for the MV. DATA_OBJECT_ID is the Segment where the data is stored. As MV object is just a model and does not have data to null.

    The user has no direct access to the MY_TEST_MV table. See this

    SQL> drop table my_test_mv;
    drop table my_test_mv
               *
    ERROR at line 1:
    ORA-12083: must use DROP MATERIALIZED VIEW to drop "KARTHICK"."MY_TEST_MV"
    

    Also, you can associate an existing table to a materialized using the clause ON TABLE PREDEFINED view.

    Here is an example

    SQL> drop materialized view my_test_mv;
    
    Materialized view dropped.
    
    SQL> create table my_test_mv_new as select * from emp;
    
    Table created.
    
    SQL> select object_type, object_name, data_object_id from user_objects where object_name = 'MY_TEST_MV_NEW';
    
    OBJECT_TYPE         OBJECT_NAME          DATA_OBJECT_ID
    ------------------- -------------------- --------------
    TABLE               MY_TEST_MV_NEW              1638967
    
    SQL> create materialized view my_test_mv_new on prebuilt table as select * from emp;
    
    Materialized view created.
    
    SQL> select object_type, object_name, data_object_id from user_objects where object_name = 'MY_TEST_MV_NEW';
    
    OBJECT_TYPE         OBJECT_NAME          DATA_OBJECT_ID
    ------------------- -------------------- --------------
    TABLE               MY_TEST_MV_NEW              1638967
    MATERIALIZED VIEW   MY_TEST_MV_NEW
    
    SQL>
    

    Once you associate a Table with a MV direct Table access is limited. You can directly access only the MV.

  • newBie Q: how to make a clickable form to access a slide with the same name of the form (button c_1 drag c_1 f.e.).

    I've done a few clickable placeholders on a masterslide

    Then: a new slide based on this masterslide

    and to use a script or shared action that says "(le saut de succès à une autre diapositive avec nom samen te que le bouton...)"

    Sorry for this unusual semantic language.

    But already thank you for answering!

    Lucas

    PS I use a trial version to test a branched interactive scenario. A choice of a user driven tot another slide with a followed video reaction of other choices,...)

    Not possible to use a variable in this case to link the label name for a name for the slide.  But I still don't see the purpose at all?

    Will you need to the same button with the same name on multiple slides? Will you use for the rest of the project timing in this case? Because you cannot reuse a name of a button, if you have two instances of this button on two different slides, they will need each a different name. If this is the same form button, programmed for the rest of the project, we will always use the same action, needs not even a tip action because it will «Pop X zip» But there is no way to use the name of the button in this action at all. Joint action is possible with X as the parameter, and then you can assign it to all the buttons that have need of this action. But why do you want that the link between the button name and the name of the slide?  Can you explain? My Captivate intuition tells me that there is a misunderstanding, perhaps because of your experiences of Lectora. Captivate is really different, presented on the differences in workflow with an expert Lectora. I no longer use Lectora but the structure, and certainly the way to 'script' is totally different.

  • where to save the files under options the file name is duplicated how to remove an additional folder with the same name

    Under Options in Firefox, I clicked on save the files under downloads, but the file name twice and an additional file with the same name is created in the folder, i.e.:

    G:\Akbar's Songs\HAMARA DOWNLOADS\HAMARA FORUMS DOWNLOADS FORUMS

    As you can see the file repeats, how can I fix it?

    Also the music files, I download from a site of downloads as a WinRar file and I need to open it. Y at - it an option where the file opens automatically in the folder I chose?

    Thanks a lot for your help.

    Hi Akush, when you install 7 - zip, make itself the default application to open .zip and .rar files. So if you double click on the .rar file, it should open in 7 - zip. If you prefer to decompress immediately, right click the file and look for new 7 - zip items in the menu. I can't think of a way to do this automatically, however.

  • I have 2 bookmarks with the same name but different stuff in them. I want to remove one, but pass the contemts remaining bookmark

    I have 2 bookmarks with the same name but different stuff in them. I want to remove one, but pass the contemts remaining bookmark

    This is the first mention you made records. See this - https://support.mozilla.org/en-US/kb/Sorting%20bookmarks#w_rearranging-manually - and move individual bookmarks from one folder to the other folder. You may need to press the Alt key to display the Menu bar and the View menu item.

  • I want to buy an iBook. There are 2 different books with the same name, author, and the book cover. They are different number of pages with different prices. Specifically, all the light that we do not see. " How do you know that we purchase?

    I want to buy an iBook. There are 2 different books with the same name, author, and the book cover. They are different number of pages with different prices. Specifically, all the light that we do not see. " How do you know that we purchase?

    I would get one that has 4700 comments already.

  • How to take a column of duplicate names and fill a different column with the same names, excluding duplicates?

    How to take a column of duplicate names and fill a different column with the same names, excluding duplicates?

    I find easier to use this copy separate Automator Service (download Dropbox).

    To install in your numbers > Services, double-click menu just the package downloaded .workflow and if necessary give permissions in system preferences > security & privacy.

    To use, just:

    1. Select the cells in the column with duplicate names.
    2. Choose separate copy in numbers > Services menu.
    3. Click once in the upper cell where you want the deduplicated values appear.
    4. Command-v to paste.

    SG

  • Problem in creating several attributes XML with the same name of the attribute

    I am trying without success trying to create several attributes XML with the same name, as shown here in a Microsoft example configuration file:



      
         
         
         
      

    I'm calling the NewDocument GetRootElement functions and then "newelement" (appSetting), "newelement" (add)

    Then I call AddAttribute with add, key & Key0, then with add, value & 0.  This seems to work fine but when I try to add the second pair of key & Key1 and value attributes & 1 for item "Add" replaces ""and I find myself with"" only.

    I do something wrong or CVI is not able to create an XML of this type?

    Thank you

    Here's how you do it. I show not to keep things simple error checking.

    #include

    public static void CreateAddElement (mother of CVIXMLElement, const char * key, const char * value)
    {
    Add the CVIXMLElement;
    CVIXMLNewElement (parent, -1, 'Add', &add);)
    CVIXMLAddAttribute (add, "touch", key);
    CVIXMLAddAttribute (add, "value", value);
    CVIXMLDiscardElement (add);
    }

    void main (void)
    {
    CVIXMLElement root, and appSetting;
    Doc CVIXMLDocument.
     
    CVIXMLNewDocument ("configuration", &doc);)
    CVIXMLGetRootElement(doc, &root);)
    CVIXMLNewElement (root,-1, "appSetting", and appSetting);
    CreateAddElement (appSetting, "Key0", "0");
    CreateAddElement (appSetting, "Key1", "1");
    CreateAddElement (appSetting, "Key2", "2");
    CVIXMLDiscardElement (appSetting);
    CVIXMLDiscardElement (root);
    CVIXMLSaveDocument (doc, 1, "c:\\temp\\temp.xml");
    CVIXMLDiscardDocument (doc);
    }

  • 2 separated registered photos with the same name of file/number.

    How can I separate 2 or more photos with the same name of file/number. Consult us in the case that I see a photo and when I open it I see a different picture. The second photo is not the case in the folder, but still I need to save. It seems they are crushed.

    How can I separate 2 or more photos with the same name of file/number. Consult us in the case that I see a photo and when I open it I see a different picture. The second photo is not the case in the folder, but still I need to save. It seems they are crushed.

    =============================================
    FWIW... If a picture was crushed (replaced), it is unrecoverable.

    Are you saying that the vignette does not match the full size photo?

    How_exactly_are you look at one picture?

    John Inzer - MS - MVP - Digital Media Experience - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

Maybe you are looking for

  • Can I really not import the Photos app in iMovie?

    Hello I use iMovie 10.0.8 on a Macbook Pro running El Capitan 10.11.4. I am the only user of this Mac and its running in standard mode administrator/Overlord. There is no guest user account, or anything else. I have a Nikon camera, when I import pict

  • Power light flashing ReadyNAS Duo

    Hi, I got a ReadyNAS duo of one of my friends, I have replace both drives of 1 TB with a same exact. I booted up the SIN and it showed on the tool Raidar. I got 'corrupt boot' so I followed the steps on the site Q & A. I did a restore and reinstall O

  • Photosmart 6520: Fotolade

    Good, Mijn printer wil op geen some handle ITU iPhoto ITU voorvertoning gehoorzamen page aan nog nog: print ITU Fotolade uitrollen tjes blijven A4.

  • Strange marks on the screen

    Hello First of all thanks for this great forum find information on my new pre. I'm having a problem with 2 white spots my screen that I can't seem to come off. The strange thing is that I can see them only when certain colors are on the mainly blue s

  • Validation of Vista

    have the product key on computer very from the internet... vista stops... theproduct key, attached to the computer is not valid... (worked for 3 years) now won'tLog in to vista... ideas...