I'm selecting everything from my players table, then I want to check if player id or player name is set in other table with an condition.
I got two tables - players and shop.
shop has the following columns: uid, dateline, from, done.
As I said, I'm selecting everything from players table, now I want to add additional column to the result called was_shopping and it will be the 1 when players.id or players.name is somewhere in the shop and where shop.dateline is higher than my variable given.
Just to be sure you understood everything correctly it should goes like this (its not a query, its just a word-example on how it should works in query):
SELECT *
FROM players
WHERE (players.id OR players.name)
IN (
SELECT `uid` AND `from`
FROM `shop`
WHERE `dateline` >= xxxxx
)
And if players.id or players.name will be inside of the shop.uid OR shop.from with dateline >= xxxxx it should add another column to the result: was_shopping - 1 OR 0 (if was found in shop table then 1, and 0 in case if not found).
Please post a comment if you don't understand a word.