In MySQL, I try to update with a join on a table and getting a 1093 error I am doing. It'm the code that I use: I also use this syntax have tried it, but it gives a compilation error: You should also take note that the alias also see the same table. I'm basically trying to update the data from a row in the table with the data from the first row (date wise). Can I get this to work?
UPDATE fdd_test as fdd1 INNER Join fdd_test as fdd2.Trade_Date = on fdd2 (select MAX (fddsub.Trade_Date) where fddsub from fdd_test fddsub .Trade_Date & lt; fdd1.Trade_Date) set fdd1.Prior_Pct_UpDn_Since_Open = fdd2.Pct_UpDn_Since_Open, fdd1.Prior_14_Day_MFI = fdd2.14_Day_MFI where fdd1.Symbol = 'A';
as fdd1 set fdd_test Update Fdd1.Prior_Pct_UpDn_Since_Open = fdd2.Pct_UpDn_Since_Open, Fdd1.Prior_14_Day_MFI = fdd2.14_Day_MFI Finally add fdd2 to fdd2.Trade_Date (select MAX (fddsub.Trade_Date) from fdd_test fddsub where fddsub.Trade_Date & lt; fdd1.Trade_Date where fdd1. Symbol = 'A';
update fdd_test as fdd1, fdd_test as fdd2 SET fdd1.Prior_Pct_UpDn_Since_Open = fdd2.Pct_UpDn_Since_Open, fdd1.Prior_14_Day_MFI = fdd2.14_Day_MFI where fdd2.Trade_Date = (select max (fddsub.Trade_Date) fdd_test fdd1.Trade_Date fddsub where fddsub.Trade_Date & LT from;) and fdd1.Symbol = 'a', `
Tuesday, 15 March 2011
sql - Getting a MySQL error code 1093: "You can't specify target table 'fdd1' for update in FROM clause" in UPDATE -
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment