Correspondence of the columns from one table to another

I have a database column that contains the name of a person. I have another table that has a column that contains the names separated by a comma.

I want to match records where all records of two columns have a corresponding name. I tried this:

< cfquery name = "MyQuery" datasource = "myds" >

SELECT *.

OF TBL_A

WHERE TBL_A.customername IN (#DifferentQuery.ListOfNames #)

< / cfquery >

Everything that I try results in only get a recording. Basically, I want to get all records from a table where one of its columns contains the name of a column in another table.

It's a many-to-many relationship. That is to say an editorial can be linked to many ads, and vice versa.  He is best represented with three tables. Such as:

Table: [Editorial] column: [EditorialID (PK), EditorialText,...]

Table: Columns of the [advertiser]: [AdvertiserID (PK), AdvertiserName]

Table:   [Editorial_Advertisers] columns: [EditorialID, AdvertiserID]

The name of the advertiser throw himself into a column...

my client can decide which ads get related to which editorials

The third table stores the relationship between ads and editorials.  So instead of storing a list of advertisers, you need to insert record for each EditorialID + AdvertiserID combination. You can then use joins to retrieve all the advertisements for EditorialID 123.

SELECT  a.AdvertiserName
FROM     Editorial_Advertiser ea INNER JOIN Advertiser a ON ea.AdvertiserID = a.AdvertiserID
WHERE   ea.EditorialID = 123

Tags: ColdFusion

Similar Questions

  • Copy all the BLOBs from one table to another

    Hi all

    I hope that I put in the right place. I am trying to copy from one table to the other BLOBs, but were usuccessful. Here is the script that I wrote to do, but it just loaded a field saying not supported. Is there something I'm missing, I'm using the APEX 3.1.2.

    Thanks for your help.

    DECLARE
    number of v_id;
    v_document blob.
    v_filename varchar2 (200);
    v_mimetype varchar2 (200);



    CURSOR c_Document IS
    SELECT id, name of the document file, mimetype
    IN v_id, v_document, v_filename, v_mimetype

    OF CAB_APPEAL_ACTIONS
    WHEN THE DOCUMENT IS NOT NULL;

    BEGIN

    FOR r_Document in c_Document
    LOOP
    INSERT INTO CAB_APPEAL_DOCUMENTS
    (APPEAL_ACTION_ID,
    DOCUMENT,
    FILE NAME,
    MIMETYPE
    )
    VALUES
    (v_id,
    v_document,
    v_filename,
    v_mimetype
    );

    END LOOP;

    END;

    In addition, what is wrong with just...

    INSERT INTO CAB_APPEAL_DOCUMENTS (APPEAL_ACTION_ID,
                                      DOCUMENT,
                                      FILENAME,
                                      MIMETYPE)
       SELECT   id,
                document,
                filename,
                mimetype
         FROM   CAB_APPEAL_ACTIONS
        WHERE   DOCUMENT IS NOT NULL;
    

    APEX will end process page in a BEGIN block... END; block anyway.

    See you soon

    Ben

  • transfer of some columns from one table to another table...?

    I had 2 table... .one is PAYMAST n other TBL... In PEXMAST & TBL 10 collar each, I had and I want to transfer 4 columns of TBL to PEXMAST...

    How do I do this. ???

    A table must be regarded as line and column.

    When you say a column, it should be associated with a line.

    Here is an example

    Let's say I have two table T1 (ID, NAME) and T2 (ID, Name1)

    Now if I say I want to spend for T2 T1 name1, what I will do?

    1 create a column name1 in T1.

    alter table t1 add name1 varchar2(50)
    

    2. put up-to-date T1 by joining T1.ID and T2.ID like that.

    update t1
       set t1.name1 = (select t2.name1 from t2 where t2.id = t1.id)
    

    As you can see you need a column ID to define the relationships between the two table T1 and T2. If you have one, you can do the same with yours.

  • How to copy columns from one table to another

    Hai All


    How to copy the contents of the array to another

    For example, first name of the table is T1 and I have 10 columns and data are here and I need to create a table T2

    But I don't need the header, but not the values of all the 10 columns of T1 to T2, but not values


    Thanks and greetings

    Srikkanth.M

    Why not?

    create table test1
    as
       select * from emp
       where 1 = 2;
    

    Kind regards.

    LOULOU.

  • Copy from one table to another

    Is there a simple way to copy/add all the records from one table to a master table?

    INSERT INTO master_table (Field1, Field2, field3)
    SELECT field1, Field2, field3
    From other_table
    WHERE everything what

    If the data types, order and the column names are the same for both tables, then it would also work to copy all other_table lines in master_table:

    INSERT INTO master_table
    SELECT *.
    From other_table

    Phil

  • I use Origami as my screensaver and changing images quickly, is there a way to slow the progression from one slide to another?

    I use Origami as my screensaver and changing images quickly, is there a way to slow the progression from one slide to another?

    Check in system preferences > Desk Top & screensaver:

    Ciao.

  • transfer of all, except the os from one computer to another

    want to transfer everything except the os from one computer to another

    Marce,

    I would like to get an external hard drive - the best of Seagate and Western Digital for about $100. I have a 320 GB Seagate and it's much more that I need. Can I save more than one computer at a time. It's basically a huge flash drive, and you can buy them both at the Wal-Mart or Target or Office Max, Office Depot, etc...

    This option is also better in the long run too - for data transfer in addition to save your documents in one place safe.

    If you feel this isn't for you, then you can move gradually using a flash drive (available at Wal-Mart, Target,...) or burn your data on CD and move it over that way.

    I hope this helps.

    -GT

  • How can I move all my files from the user from one user to another on my pc?

    original title: moving files

    How can I move all my files from the user from one user to another on my pc?

    Log an administrator account. Open your folder 'user '. Select all the files, copy them, and paste them into the other folder 'user '.

  • How to move the FILE from one place to another and keep "Indexing" have to move to the unknown location so you can't discover its full file path? Windows instructions provide information wrong re: how to do this!

    Make a bunch of audio files, placed in a folder on my desktop. Files initially sent to RealPlayer to burn, but when finished burning CD and went to read a CD, folder got seized by Media Player, 'Indexed' and disappeared from the office. I'm a relatively new computer user, and I need to learn more about file paths, how to view the path FULL of a file on my computer and how to type (create) full path when I need to. The "Indexing" feature seems to erase this lesson for me, and after having spent four hours trying to find Vista instructions on "How to move the file from one place to another", I gave up! Windows 'Help and Support' on my computer gives wrong directions. It states that if I right click on a folder > properties, a dialog box opens with a tab by which I can move my account. There is no tab location here. I found locations tab when right click on the "Mobile" folder, but still no option to "move file". No idea what is the folder "Roaming" or why it's on my computer. I want my audio files in the My Music folder, but this place is "access denied." Don't know how to get the audio file it in any case, but if anyone has any advice, I would be very happy! Thank you. PS - I had no problem moving folders in XP. I don't like the idea that a computer is to decide where to put my files. I want to control where I put my files. I don't like the way search works under Vista. I liked the XP search companion better because, for a computer fool like me, it was really easy to organize and find files and folders and had an option specific to find audio and video file TYPES.

    Here is an article on how to move your personal folders in Vista: http://www.howtogeek.com/howto/windows-vista/moving-your-personal-data-folders-in-windows-vista-the-easy-way/.  If you're talking about the special folders (such as photos, Documents, office...), then here is an article on how to move: http://www.winhelponline.com/articles/95/1/How-to-move-the-special-folders-in-Windows-Vista.html.

    If you have trouble with the search after you move the files, then rebuild the index: http://www.tech-recipes.com/rx/2103/vista_rebuilding_the_search_index/.  Here is an article on how to use Indexing Options in Vista that may be useful for you: http://www.vistax64.com/tutorials/69581-indexing-options.html.

    If the above does not help, your problem seems to relate to the image of the files/folders and their interactions with Media Center (which operate on different other folders).  Please repost your question in images and video Forum at: http://social.answers.microsoft.com/Forums/en-US/vistapictures/threads where the people who specialize in issues of the image will be more than happy to help you with your quesitons.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Is it possible to transfer the license from one computer to another by e-mail

    Is it possible to transfer the license from one computer to another by e-mail

    OS: Windows 7 Home Premium

    No, you transfer the license by ensuring its removed from the current computer. Continue to install on the new machine and reactivate by phone:

    Activate Windows 7 manually:
    1. click on start and in the search for box type: slui.exe 4

    2. press enter on your keyboard

    3. Select your country.
    4. Select the telephone activation option and brace yourself for a real person.

    Releasing it's easy: with Windows | ActiveWin | Laptops | Microsoft MVP

  • Move a file to the muse from one computer to another that I will lose all related is pdf! How to solve it?

    Move a file to the muse from one computer to another that I will lose all related is pdf! How to solve it?

    Hello.

    Please try following steps to recreate a link to the PDF files.

    1. move and place the PDF file all missing in the any folder to the new computer.

    2 open the Control Panel file Muse and hit open assets of Windows > assets

    3. right click on a missing PDF file and choose repeat the link.

    4. Select the correct file to recreate a link and it will connect all the missing files in the folder.

    Let me know if you were talking about something else.

    Concerning

    Vivek

  • How can I reinstall the Photoshop from one computer to another? I didn't need a second license...

    How can I reinstall the Photoshop from one computer to another? I didn't need a second license...

    You are allowed to install Photoshop on two computers. Recent versions allow to choose if they are versions Mac or Windows, or one of each!

  • move the CS6 from one computer to another

    I'm trying to move the CS6 from one computer to another, but I can't get the serial number to activate.  Help

    Hello

    Please visit the below mentioned link doc KB and try the solutions:

    Error: "this serial number is not for a product calling it" | Adobe Creative Suite

    Hope this will help.

    Kind regards

    Ana Maria

  • Need some ideas on the copy of the data from one schema to another.

    Dear all,

    I would like to know the best method and possible by copying data from one schema to another. (I won't use EXP / IMP).
    Example:


    I have a scheme of production on which I have hundreds of tables. I copy the data of the TEST environment after comparing data, I should copy the data incrementally.
    Maybe this copy of data may occur once a month, or on request.

    I want to have this done by a procedure.
    I was thinking about the logic below, using a procedure I will compare the tables and the structures between the two schemas.
    Then I willl use the primary key in both tables column and compare the data first. If the data if it does not exist then I only inserts these records in the target.
    The above said logic could be as similar as the synchronization of data or records, but the table does not all columns to track records archived / copied from the source.
    Suggest me so if you can give me the best logic or solution.

    Thanks in advance...

    Concerning
    Suresh

    GSKumar wrote:
    Dear all,

    I would like to know the best method and possible by copying data from one schema to another. (I won't use EXP / IMP).
    Example:
    I have a scheme of production on which I have hundreds of tables. I copy the data of the TEST environment after comparing data, I should copy the data incrementally.
    Maybe this copy of data may occur once a month, or on request.

    I want to have this done by a procedure.
    I was thinking about the logic below, using a procedure I will compare the tables and the structures between the two schemas.
    Then I willl use the primary key in both tables column and compare the data first. If the data if it does not exist then I only inserts these records in the target.
    The above said logic could be as similar as the synchronization of data or records, but the table does not all columns to track records archived / copied from the source.
    Suggest me so if you can give me the best logic or solution.

    I don't know why you don't want to opt for EXP/IMP.
    As an alternative, if you have a link DB between Production and Test pattern (which I seriously doubt), you can use the MERGER to a copy of data from Production to Test Delta.
    a. INTRODUCE IN test_schema.table_name SELECT sequence_columns, column_list FROM (SELECT column_list FROM prod_schema.table_name LESS SELECT column_list from test_schema.table_name)
    Column_list must not contain columns that contain sequence values because they may differ and result in an incorrect result; Therefore, this is taken into account in the outer query rather than Inline mode.
    b. MERGE STATEMENT
    c. FALL of test_schema.table_name. CREATE test_schema.table_name as SELECT column_list from prod_schema.table_name; -A way very neat to copy all the data, provided you do not keep any changes to test the tables in the schema.

    However, you mentioned to find existing records based on the primary key; IMO, primary key is normally a sequence (may be alphanumeric) and its value on env Production and Test may defer or even can have different attributes, therefore, I find it incorrect to match only the primary keys. I would say to match the key attributes.

    If you want to follow the last update/insert for a record, you can add a column that puts the time of last modification. In this way, you can track the changes of a column. Another alternative would be to use a check to the table.

    Let us know your thoughts or concerns, so that help can be provided.

    I suggest that you read and follow {message identifier: = 9360002}.
    If you will be useful if you can provide all the information required in advance to help us provide you with a quick resolution.

  • Shutter button to copy records from one table to another;  ORA-04091:

    Hello

    I am trying to create a trigger that will move data from one table to the other.

    I have two tables (Trial1, Trial2) two of them contains the same attributes (code, c_index)

    I want to spend each new record inserted in (code Trial1) (code in Trial2)

    It's my trigger:
    Create or replace trigger trg_move_to_trial2
    After Insert on Trial1
    for each row
    Start
    insert into Trial2 (code)
    Select: new.code of Trial1;
    end;
    He compiled, but when I insert a new record (the code) in (Trial1), it shows this error:
    Error report:
    SQL error: ORA-04091: table STU101. TRIAL1 is changing, function of triggering/can not see
    ORA-06512: at "STU101. TRG_MOVE_TO_TRIAL2', line 3
    ORA-04088: error during execution of trigger ' STU101. TRG_MOVE_TO_TRIAL2'
    04091 00000 - "table %s.%s is changing, function of triggering/can not see.
    * Cause: A trigger (or plsql user-defined function that is referenced in)
    This statement) attempted to watch (or modify) a table that has been
    in the Middle being modified by the statement that shot.
    * Action: Rewrite the trigger (or function) so it does not read this table.
    I know matter what it means error, but I did not how to fix the error.

    ..................................................................................................

    I tried to change the (insert after on Trial1) before (insert on Trial1); It worked, but not in a good way. When I insert value in (code Trial1) new and refreshed Trial2 table, just as much as the records I have 2 test they will be duplicated. For example
    Trial2
    code
    111
    222
    333
    when I insert in Trial1
    Trial1
    code
    444
    Trial2 will be:
    code
    111
    222
    333
    444
    444
    444
    can you please tell me how to fix this?

    Kind regards

    Published by: 1002059 on April 23, 2013 17:36

    You should not select Trial1 - you already have data. Simply insert this value.

    Create or replace trigger trg_move_to_trial2
    After insert on Trial1
    for each row
    
    begin
    
    insert into Trial2 (code)
    values (:new.code);
    
    end; 
    

    Kind regards
    David

Maybe you are looking for

  • The iPhoto v8.1.2 update

    I understand to get iPhoto to work on El Capitan, I need to upgrade to the latest version. My problem seems to be that the version I have is the original that came preinstalled on my macbook pro (v8.1.2). I can not find the new version of the App Sto

  • W700 Windows 8.1 x 64-driver equipped with fingerprint

    Hello.I can't find the driver of sensor of fingerprint for W700 Windows 8.1 x 64 Any idea?

  • Loop iteration from break

    I want to Pause a while loop based on a user imput and continue if the entry is changed. For example I want to have the loop run 5,000 times and then stop, and then after that it stops, I have change the number to 10,000, I want it to work only 5 000

  • Perform a successful backup

    I have a HP Pavilion dv7t - 6 c 00 CTO Entertainment Notebook PC with Windows 7 - 64 Bit OS and I'm having a terrible time, get a successful backup, I am using a WD 500 GB external hard drive, but I continue get a lack of space error, what should I b

  • The "operator".

    HelloWhen I run this query in pl/sql: select * from mr_patient_visits where visit_id in (3081,3078,3080) ; This result is sorted, the3078 is displayed first, then3080, then3081.I don't want to do, I want to show them that their order in the 'operator