Results 1 to 3 of 3

Thread: a complex sql update

  1. #1
    Join Date
    Jun 2006
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default a complex sql update

    The Error I am recieiving:
    Error in query: UPDATE dw_eqpt_cat_main SET `sCat_Name` = 'KELLY' ( SELECT iItem_Id, iCat_Id FROM dw_eqpt_items WHERE `iCat_Id` = '1' AND `iItem_Id` = '690') LIMIT 1

    It looks like it is processing the information correctly.

    my query:
    Code:
    			
    $sCat_Name= $_POST['sCat_Name'][$i];
    $iCat_Id = $_POST['iCat_Id'][$i];
    $iItem_Id = $_POST['id'][$i];
    
    $update_sCat_Name = "UPDATE $tbl_name2  
    SET `sCat_Name` = '$sCat_Name' ( SELECT iItem_Id, iCat_Id
    FROM $tbl_name
    WHERE `iCat_Id` = '$iCat_Id' AND `iItem_Id` = '$iItem_Id') LIMIT 1";

  2. #2
    Join Date
    Jun 2006
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    SOLVED
    http://dev.mysql.com/doc/refman/5.0/en/update.html

    UPDATE `Table A`,`Table B`
    SET `Table A`.`text`=concat_ws('',`Table A`.`text`,`Table B`.`B-num`," from ",`Table B`.`date`,'/')
    WHERE `Table A`.`A-num` = `Table B`.`A-num`

  3. #3
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    if you use mysql you have to remove
    " FROM $tbl_name "

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
  •