Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- b.`ID` AS `ID`,
- c.`product_id` AS `product_id`,
- c.`nome_prodotto` AS `nome_prodotto`,
- c.`link_prodotto` AS `link_prodotto`,
- c.`img_link` AS `img_link`,
- c.`prezzo` AS `prezzo`,
- c.`fornitore` AS `fornitore`,
- c.`contatto_fornitore_1` AS `contatto_fornitore_1`,
- c.`contatto_fornitore_2` AS `contatto_fornitore_2`,
- c.`descrizione` AS `descrizione`,
- c.`disponibili` AS `quantity_max`,
- c.`disponibili_oggi` AS `disponibili_oggi`,
- c.`venditore` AS `venditore`,
- c.`venditore_es` AS `venditore_es`,
- c.`venditore_en` AS `venditore_en`,
- c.`venditore_fr` AS `venditore_fr`,
- c.`venditore_de` AS `venditore_de`,
- c.`nome_prodotto_en` AS `nome_prodotto_en`,
- c.`nome_prodotto_fr` AS `nome_prodotto_fr`,
- c.`nome_prodotto_de` AS `nome_prodotto_de`,
- c.`nome_prodotto_es` AS `nome_prodotto_es`,
- c.`prezzo_en` AS `prezzo_en`,
- c.`prezzo_fr` AS `prezzo_fr`,
- c.`prezzo_de` AS `prezzo_de`,
- c.`prezzo_es` AS `prezzo_es`,
- c.`fornitore_en` AS `fornitore_en`,
- c.`fornitore_fr` AS `fornitore_fr`,
- c.`fornitore_de` AS `fornitore_de`,
- c.`fornitore_es` AS `fornitore_es`,
- c.`descrizione_en` AS `descrizione_en`,
- c.`descrizione_fr` AS `descrizione_fr`,
- c.`descrizione_de` AS `descrizione_de`,
- c.`descrizione_es` AS `descrizione_es`,
- c.`disponibili_en` AS `disponibili_en`,
- c.`disponibili_fr` AS `disponibili_fr`,
- c.`disponibili_de` AS `disponibili_de`,
- c.`disponibili_es` AS `disponibili_es`,
- c.`link_prodotto_es` AS `link_prodotto_es`,
- c.`link_prodotto_en` AS `link_prodotto_en`,
- c.`link_prodotto_fr` AS `link_prodotto_fr`,
- c.`link_prodotto_de` AS `link_prodotto_de`,
- c.`cat_it` AS `cat_it`,
- c.`cat_es` AS `cat_es`,
- c.`cat_de` AS `cat_de`,
- c.`cat_en` AS `cat_en`,
- c.`cat_fr` AS `cat_fr`,
- a.`user_login` AS `user_login`,
- a.`ID` AS `user_id`,
- a.`email` AS `email`,
- b.`quantity` AS `quantity_ask`,
- b.`date` AS `date`,
- (
- SELECT
- SUM(h.prezzo * g.quantity) AS total_price_prod
- FROM
- amz_usr as f inner join amz_cart as g on f.ID = g.user_id inner join amz_prod as h on g.product_id = h.product_id
- WHERE
- c.`product_id` = g.`product_id` AND a.`ID` = g.`user_id`
- ) AS `total_price_prod`,
- (
- SELECT
- SUM(a.quantity) AS total
- FROM
- amz_cart a INNER JOIN amz_prod b ON a.product_id = b.product_id
- WHERE
- c.`product_id` = b.`product_id` and
- date_format(from_unixtime(b.`date`), '%d') = dayofmonth(curdate()) and
- date_format(from_unixtime(b.`date`),'%m') = month(curdate()) and
- date_format(from_unixtime(b.`date`),'%Y') = year(curdate())
- ) AS `oggi`,
- (
- SELECT
- SUM(a.quantity) AS total
- FROM
- amz_cart a INNER JOIN amz_prod b ON a.product_id = b.product_id
- WHERE
- c.`product_id` = b.`product_id` and
- date_format(from_unixtime(b.`date`),'%m') = month(curdate()) and
- date_format(from_unixtime(b.`date`),'%Y') = year(curdate())
- ) AS `mese`,
- (
- SELECT
- SUM(a.quantity) AS total
- FROM
- amz_cart a INNER JOIN amz_prod b ON a.product_id = b.product_id
- WHERE
- c.`product_id` = b.`product_id` and
- date_format(from_unixtime(b.`date`),'%Y') = year(curdate())
- ) AS `anno`,
- (
- SELECT
- SUM(a.quantity) AS total
- FROM
- amz_cart a INNER JOIN amz_prod b ON a.product_id = b.product_id
- WHERE
- c.`product_id` = b.`product_id`
- ) AS `totali`
- from
- amz_usr as a inner join amz_cart as b on a.ID = b.user_id inner join amz_prod as c on b.product_id = c.product_id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement