Professional Web Applications Themes

Batch update? - MySQL

Consider two tables: Table_1 (id, data_1, data_2) Table_2 (id, data_2) How to load the `data_2` field from Table_2 to Table_1, which is linked by `id`? Thanks....

  1. #1

    Default Batch update?

    Consider two tables:

    Table_1 (id, data_1, data_2)

    Table_2 (id, data_2)


    How to load the `data_2` field from Table_2 to Table_1, which is linked
    by `id`?

    Thanks.

    howachen@gmail.com Guest

  2. #2

    Default Re: Batch update?


    [email]howachen[/email] wrote:
    > Consider two tables:
    >
    > Table_1 (id, data_1, data_2)
    >
    > Table_2 (id, data_2)
    >
    >
    > How to load the `data_2` field from Table_2 to Table_1, which is linked
    > by `id`?
    >
    > Thanks.
    update Table_1,Table_2
    set Table_1.data_2 = Table_2.data_2
    where Table_1.id=Table_2.id

    Captain Paralytic Guest

  3. #3

    Default Re: Batch update?


    Captain Paralytic 寫道:
     
    >
    > update Table_1,Table_2
    > set Table_1.data_2 = Table_2.data_2
    > where Table_1.id=Table_2.id[/ref]

    Thanks

    Another question: Is it possible to emulate the following kind of query
    using SQL?

    such as

    UPDATE Table_1 SET Table_1.data_2 = (SELECT ...)

    of coz I know this is not possible, but it is to emulate these kind of
    jobs as a sequence of SQL create temp table/insert/join ?

    howachen@gmail.com Guest

  4. #4

    Default Re: Batch update?

    com wrote: 
    >>
    >> update Table_1,Table_2
    >> set Table_1.data_2 = Table_2.data_2
    >> where Table_1.id=Table_2.id[/ref]
    >
    > Thanks
    >
    > Another question: Is it possible to emulate the following kind of
    > query using SQL?
    >
    > such as
    >
    > UPDATE Table_1 SET Table_1.data_2 = (SELECT ...)
    >
    > of coz I know this is not possible, but it is to emulate these kind of
    > jobs as a sequence of SQL create temp table/insert/join ?[/ref]

    I'm not sure what you're asking here. You can do an
    INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
    [INTO] tbl_name [(col_name,...)]
    SELECT ...
    [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]


    Paul Guest

Similar Threads

  1. Datagrid batch update
    By Applevalley01 in forum ASP.NET Data Grid Control
    Replies: 3
    Last Post: December 28th, 06:59 AM
  2. Batch update
    By JP in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: December 21st, 08:07 PM
  3. Batch Processing, not quite batch
    By Ken_Blesse@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 2
    Last Post: May 19th, 02:03 PM
  4. batch update symbols across multiple pngs - fireworks MX?
    By Bbonnn webforumsuser@macromedia.com in forum Macromedia Fireworks
    Replies: 1
    Last Post: August 9th, 05:01 AM
  5. batch update exception
    By Mehmet Gunacti in forum IBM DB2
    Replies: 0
    Last Post: June 27th, 11:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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