[英]How to check if the given username in the register page exists in some of the two tables
[英]combine value from two tables for a given username
我有一個要求,其中有兩個數據庫表users和users_custom,其后是幾列。
用戶表
userkey,
username,
first name,
last name,
employee id,
status
users_custom表
userkey,
custom_property_1,
custom_property_2,
custom_property_3,
custom_property_4
users_custom中的userkey是外鍵。
我已經獲得了用戶名的值
如何構造一個查詢,該查詢將合並兩個表中的一個用戶名可用的單個用戶的值。
任何幫助或指針將不勝感激。
嘗試這個
SELECT * FROM users LEFT JOIN users_custom ON users.userkey = users_custom.userkey WHERE users.username = "name";
這里的name是提供給您的用戶名的值
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.