我在Ms-Sql中有以下查询
INSERT INTO tbl_web_price_update
Select bd_book_code,
Case
When pd.bpd_price is null then
cast((a.bd_price*c.ptm_price) as numeric(10))
else
cast((pd.bpd_price*c.ptm_price) as numeric(10))
end
As Price
from tbl_books_details a
inner join tbl_price_type_master c on a.bd_price_type = c.ptm_price_type_id
left join tbl_books_price_details pd on pd.bpd_book_code = a.bd_book_code
Where c.ptm_price_type_id = @price_type
SELECT distinct r.price, STUFF((SELECT distinct ','+ Cast(a.bd_book_code as varchar) FROM tbl_web_price_update a WHERE r.price = a.price FOR XML PATH(''), TYPE).value('.','VARCHAR(max)'), 1, 1, '') FROM tbl_web_price_update r
我已从 MS-SQL 迁移到 MySQL,但无法在 MySQL 中编写替代性查询。请帮忙。