MySQL - 如何连接2个将行转换为列的表

时间:2015-09-20 15:21:25

标签: mysql join view

我在MySQL中有两个表,一个是应用程序,另一个是application_storefront。它们看起来像这样:

应用程序:

Fetched credentials from request {'response_type': 'token', 'state': None, 'client_id': 'jCce40zAaHXLxP0prU************', 'redirect_uri': 'http://localhost:8000/authorized'}.
Found redirect_uri http://localhost:8000/authorized.
Validate client 'jCce40zAaHXLxP0prU***********'
Save bearer token {'scope': 'email', 'access_token': 'y08hkm594YbLe2*****', 'expires_in': 180, 'token_type': 'Bearer'}
Authorization successful.
127.0.0.1 - - [20/Sep/2015 17:40:53] "POST /oauth/authorize?client_id=jCce40zAaHXLxP0prU*********&client_secret=vzf7U219hrAjIYN70NcFo3VBQzot**********&response_type=token&grant_type=password&scope=email&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2Fauthorized HTTP/1.1" 302 -

和表application_storefront,它是应用程序可用的国家/地区:

application_id | title           
------------------------------------
529479190      | Clash of Clans  
553834731      | Candy Crush Saga

我想创建一个视图或新表,每个国家/地区代码作为一列,然后标记该应用程序是否在该国家/地区可用,例如

application_id | country_code
--------------------------------
529479190      | USA
529479190      | GBR
529479190      | AUS

你如何在MySQL中实现这一目标?

0 个答案:

没有答案