小编mag*_*1te的帖子

我应该在每次请求时打开 MySQL 连接还是始终打开?

假设我每 2 秒执行一次查询,我应该在每个请求上打开连接,还是应该保持连接处于活动状态直到应用程序(服务器)停止?

mysql connection

6
推荐指数
1
解决办法
1889
查看次数

SQL SELECT名称由id

我需要有关sql查询的帮助.

我有这两个表:

player_locations:

ID |  playerid  | location <- unqiue key
---|-----------------------
 1 |    1       | DOWNTOWN
Run Code Online (Sandbox Code Playgroud)

users:

ID  | playername | [..]
----|--------------------
 1  | example1   | ...
Run Code Online (Sandbox Code Playgroud)

我需要一个选择,以获得users.playernameplayer_locations.playerid.我有独特的地理位置player_locations.playerid.

伪查询:

SELECT playername 
FROM users
WHERE id = player_locations.playerid 
  AND player_locations.location = "DOWNTOWN";
Run Code Online (Sandbox Code Playgroud)

输出应该是example1.

mysql sql select join

0
推荐指数
1
解决办法
2万
查看次数

标签 统计

mysql ×2

connection ×1

join ×1

select ×1

sql ×1