Transform and pivot like in mysql question -


I hope someone can show me the light.

I've been trying to get a result for a long time. As a result, some sales of weeks, days and years in a question with some occasion.

I have got a syntax that can help me but does not work in mysql.

  Transformum Yoga (Cantidad) AS VENCHES Select Product, # 1-01-1998 # and # 12-31-1998 # Products by Order Product Manufacturer PIVOT Dnepart ("M") by Candidad Fedidos WEEE FECHA My original question is:  
  Select sum (orders.final_price) as a total, orders.id_commercial, orders from vendedores .nombre, venders WHERE orders.id_commercial = Vendedores.id and DATE (orders.date_purchased) = DATE (NOW ()) GROUP BY orders.id_commercial   

I really appreciate some ideas Am this The pen can be late in the night;)

The result of my query is:

  Total ID_commerce nambre 740.83 24 ator anguova 2069.37 29 Fernando I 482.05 32 Jose András 961.32 33 Alberto Fernandes-Cantabria-908.66 34 Gonzalo 49.54 38 Luis Lopez 4082.42 39 Julen Cura 1512.87 43 Alberto Pollution 1268.91 44 Massimo 326 9 608 José Ramón Burgo 56.49 47 Empressa 279656 48 Marco Morilo 1445.57 61 Tino 869.73 63 Soya 1052.02 381 David ARIS   

Really everyone thnx

For example, this will give you the amount of day, 7-day and year-by-day Select the amount (when the matter is DATE (orders.date_purchased) = DATE (now ()) then orders.final_price end) Total Today, amount (case when DATE (orders.date_purchased) & Orders of total yuantodet, as in the form of the last date (now () -7) then orders (final_price end) total total7days, amount (case when year (orders.date_purchased) = yEAR (now ()) order. .id_commractor, vendedores.nombre by order, wadder where order.ad_commerce = vendedores.id And orders.date_purchased & gt; Order = date (concat (year (now (now (), '- 01-01')) by group. FCI / code> date (concat (year (now), '- 01-01')) gives you the first day current year

But if you want a pivot table, then select

  (in case when MONTH (orders.date_purchased) = 1 then orders.final_price end) AS Jan, zodiac (case when MONTH (orders.date_purchased) = 2. Then order. Last_pris end) AS Feb ...., zodiac (case when MONTH (orders.date_purchased) = 12 order then .final_price end) AS Dec, order.id_commercial, order vendedores.nombre, viderender WHERE Adeshkaidi_comrs = vendedores.id and orders.date_purchased & gt; = Date (Context ('(- (01-01')) GROUP BY orders.id_commercial, vendedores.nombre   

Any MySQL equivalent to Access Operator Transform (or There is no other decent RDBMS for that matter, which automatically generates a dynamic number of columns from the data.

Comments