SQL Error: Duplicate column name 'book_value' at /usr/home/lurk/smart-lab.ru/web/plugins/trade/classes/modules/moex/mapper/Moex.mapper.class.php line 845
Array ( [code] => 1060 [message] => Duplicate column name 'book_value' [query] => SELECT r.* FROM ( SELECT DISTINCT aa.sector_id, IF(aa.ticker <> "", aa.ticker, aa.ticker_p) AS sec_id, aa.last_report_year, aa.last_report_type, sc.time, sc.last, sc.last_to_prev_price, s.issue_capitalization, ax.name AS short_name, aa.article_id, y.revenue, y.net_income, y.ebitda, y.net_operating_income, y.net_intertest_margin, y.roe, y.roa, (@market_cap:= (IFNULL(sc.last * y.number_of_shares, IFNULL(y.common_share * y.number_of_shares, 0)) + IFNULL(sp.last * y.number_of_priv_shares, IFNULL(y.priv_share * y.number_of_priv_shares, 0))) / 1000) AS market_cap, (@book_value:=(IFNULL(y.assets, 0) - IFNULL(y.intangible_assets, 0) - IFNULL(y.goodwill, 0))) AS book_value, (@ev:=(@market_cap + IFNULL(y.net_debt, 0))) AS ev, y.net_margin, y.bank_margin, IF(y.capital, @market_cap / y.capital, NULL) AS p_b, IF(y.net_income, @market_cap / y.net_income, NULL) AS p_e, IF(y.revenue, @market_cap / y.revenue, NULL) AS p_s, IF(@book_value, @market_cap / @book_value, NULL) AS p_bv, IF(y.ebitda, @ev / y.ebitda, NULL) AS ev_ebitda, IFNULL(IFNULL(y.dividend, 0) / sc.last, IFNULL(y.dividend, 0) / y.common_share) AS div_yield, IFNULL(IFNULL(y.dividend_pr, 0) / sp.last, IFNULL(y.dividend_pr, 0) / y.priv_share) AS div_yield_priv, IF(y.net_income, y.dividend_payout / y.net_income, NULL) AS div_payout_ratio, IF(y.revenue, y.ebitda / y.revenue, NULL) AS ebitda_margin, IF(y.ebitda, y.net_debt / y.ebitda, NULL) AS debt_ebitda, IF(@ev, @ev * 1000/ y.installed_capacity, NULL) AS price_to_capacity , y.book_value FROM ls_dictionary_company_attributes AS aa LEFT JOIN ls_dictionary_article AS ax ON ax.id = aa.article_id LEFT JOIN ls_moex_shares_last AS s ON s.sec_id = aa.ticker OR s.sec_id = aa.ticker_p LEFT JOIN ls_moex_shares_last AS sc ON sc.sec_id = aa.ticker LEFT JOIN ls_moex_shares_last AS sp ON sp.sec_id = aa.ticker_p LEFT JOIN ls_moex_shares_additionals AS a ON s.sec_id = a.sec_id LEFT JOIN ls_dictionary_company_report_year AS y ON aa.article_id = y.article_id AND aa.last_report_year = y.year AND aa.last_report_type = y.type WHERE aa.last_report_type IS NOT NULL ) AS r WHERE 1 = 1 ORDER BY book_value desc [context] => /usr/home/lurk/smart-lab.ru/web/plugins/trade/classes/modules/moex/mapper/Moex.mapper.class.php line 845 )