gpt4 book ai didi

MySQL - 通过id从另一个表中选择,通过用户名从不同的表中获取id

转载 作者:行者123 更新时间:2023-11-29 06:17:24 25 4
gpt4 key购买 nike

我有一个名为 Players 的基本表,它包含有关玩家的基本数据,例如用户名、ID 和个人数据。

我有另一个表,用于用户的身份验证,其中包含身份验证数据。每个字段都属于一个 player_id

现在,我不想发送两个查询,我想在一个查询中执行此操作:

如何仅通过玩家的用户名获取身份验证数据(包括玩家数据)?我需要从玩家中进行选择,获取 ID 并从身份验证中进行选择,但我将如何构建该查询?

最佳答案

试试这个你应该使用JOIN'从playersauthentication获取数据`

SELECT players.player_table_fields, authentication.authentication_table_fields  
FROM players JOIN authentication
ON players.player_id = authentication.player_id

关于MySQL - 通过id从另一个表中选择,通过用户名从不同的表中获取id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35084417/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com