mysql - Use results returned from select subquery in update query -


I need to have a query that updates me a table I this query My selection:

  so.fk_customer, if (((amount (lgg.fk_catalog_attribute_option_global_gender = 1) / calculated (lgg.fk_catalog_attribute_option_global_gender)) * 100 & gt; 60) and (c .gender = 'I'), ' men, if (((amount (lgg.fk_catalog_attribute_option_global_gender = 2) / calculated (lgg.fk_catalog_attribute_option_global_gender)) * 100 & gt; 60) and (c.gender = 'woman'), 'I', '')) Calculation in the form of the list_attribute_link_global_gender as the Gender suggestion included in the LGG Inner Vi_smple AS cs ON cs.fk_catalog_config = lgg.fk_catalog_config Join Inner sales_order_item on SII. Software = CSK .id_sales_order on the inside c.id_customer = so.fk_customer where in the form of being in the lgg.fk_catalog_attribute_option_global_gender (1,2) and so.created_at DATE_SUB (NOW), interval 30 days) and now between () group so.fk_customer Join customer count (lgg.fk_catalog_attribute_option_global_gender) & gt; 2   

I have another table in which one column is fk_customer and column gender, I have to update that table with the result from the above question. I need to do this in a single question. The above query is giving me the right result.

You may have to merge update statement with this query:

  Update anotherTable select a JOIN (so.fk_customer) if ((((zodiac (lgg.fk_catalog_attribute_option_global_gender = 1) / calculation (lgg.fk_catalog_attribute_option_global_gender)) * 100 & 60; and (c.gender = ' men), "men", if (((amount (lgg.fk_catalog_attribute_option_global_gender = 2) / calculated (lgg.fk_catalog_attribute_option_global_gender)) * 100 & gt; 60) and (c.gender = 'woman'), 'women' '')) As calculatedGender, the catalog_attribute_link_global_gender from the 'ID' as the LGG intermediate catalog_simple c Include cs.fk_catalog_config = lgg.fk_catalog_config as in the form of insider sales_order_item but include soi.sku = cs.sku sales_order interiors on Soi Soi as then on .fk_sales_order = so.id_sales_order as in the interiors Where c.id_customer = so.fk_customer join the customer between lgg.fk_catalog_attribute_option_global_gender (1,2) and so.created_at Join DATE_SUB (NOW (), 30 days of interval) and so.fk_customer calculation by () lgg.fk_catalog_attribute_option_global_gender Group to be & gt; 2) B on A'aidi '= B' Aaidi 'SET A Fkgrahk = B Fkagstr, Ajiander = B Karekleted gender;   

This will give you the desired results, in which the 'ID' column will be detected, on which you will be involved in both Table A and B.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -