• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[SQL] I need help with SQL

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
HI,
I got this sql

INSERT INTO gamecodes (gamecode, accountname, points, alreadyused) VALUES ('RANDOMCODE','PLAYERNAME',30,'N')

I need a sql code that find account name in table ACCOUNTS using PLAYERNAME
 
Last edited:
Visual seperation to help you better understand left join
SQL:
SELECT
accounts.name
FROM
accounts
LEFT JOIN
players
ON
players.account_id
WHERE
players.account_id = accounts.id
AND
players.name = 'PUTPLAYERNAMEHERE'

Code for SQL
SQL:
SELECT accounts.name FROM accounts LEFT JOIN players ON players.account_id WHERE players.account_id = accounts.id AND players.name = 'PUTPLAYERNAMEHERE'
 
Last edited:
Back
Top