BLOB in MySQL view instead of the proper data

血红的双手。 提交于 2019-12-06 13:41:49

When you create a view with a UNION, you have to make sure the data types of the corresponding columns are the same (or at least, similar enough for one to be converted to the other). In the current case, the first column of the view is a publishers or a price_vat, and no data type definition apart from BLOB can make much sense of that.

If you really need this as a view, you could try...

SELECT e.price_vat AS price_vat, 
       NULL        AS publishers,
       ...etc...
       'e'         AS type
    FROM ama_euromedia_products AS e;
UNION ALL
SELECT
     NULL         AS price_vat,
     k.publishers AS publishers, 
     ...etc...
     'k'          AS type
     FROM ama_kosmas_products AS k;

to get a single data type into each column.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!