Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
基于该列的值创建MYSQL列(别名)_Mysql_Group By_Substring_Column Alias - Fatal编程技术网

基于该列的值创建MYSQL列(别名)

基于该列的值创建MYSQL列(别名),mysql,group-by,substring,column-alias,Mysql,Group By,Substring,Column Alias,我有下列表格 Products, Prices, stores (Suppliers) and Country 产品表: ProductID, ProductName 存储表: StoreID, StoreName, Country (country name of the supplier) 价格表: PriceID, Date, Price, StoreID, ProductID 国家表 CountryID, StoreID, CountryName 示例价格表数据(ID、日期、价

我有下列表格

Products, Prices, stores (Suppliers) and Country
产品表:

ProductID, ProductName
存储表:

StoreID, StoreName, Country (country name of the supplier)
价格表:

PriceID, Date, Price, StoreID, ProductID
国家表

CountryID, StoreID, CountryName
示例价格表数据(ID、日期、价格、StoreID、ProductID)

库存表

1, Supplier1, UAE
2, Supplier2, GB
在产品表中

8, iPad Air 32GB 4G
9, iPad Air WiFi 16GB
现在我需要创建一个基于线条的图表。图表上有两条线。要创建这两行,我需要此表中的两列-阿联酋和英国

所以我的预期结果是

ID Date        UAEPrice  UKSupplier SupplierName
1 01-10-2014  1500       Null       Supplier-1
2 01-10-2014  NULL       1800       Supplier-2
3 10-10-2014  NULL       1700       Supplier-2
4 01-09-2014  1200       Null       Supplier-1
5 07-09-2014 Null        1300       Supplier-1
我对此感到困惑。。。目前我正在尝试使用两个表视图(一个带有
stores.countryID='AE'
,另一个带有
stores.countryID'AE'


请提供帮助。

您能发布您当前的查询吗?我有一些类似的问题,我认为我们应该使用GROUP_CONCAT(),任何人都可以使用GROUP_CONCAT()回答?我几乎完成了。。。如果我能显示日期一的结果,那么我会得到一个结果。。。那么,问题是如何输入日期列?您似乎已经回答了关于如何输入列别名的问题。是的。。。我从谢谢大家那里得到了答案。。。
ID Date        UAEPrice  UKSupplier SupplierName
1 01-10-2014  1500       Null       Supplier-1
2 01-10-2014  NULL       1800       Supplier-2
3 10-10-2014  NULL       1700       Supplier-2
4 01-09-2014  1200       Null       Supplier-1
5 07-09-2014 Null        1300       Supplier-1