Execute a Mysql command(event) if the "item" is not in two separate databases

Asked

Viewed 12 times

0

Hello is basically the following is a Webgame where every 5 min runs the regeneration command, the command would be this:

UPDATE 
  `_personagens` 
SET 
  vida = IF(
    vida +(vida_m * 0.05)> vida_m, 
    vida_m, 
    vida +(vida_m * 0.05)
  ), 
  chakra = IF(
    chakra +(chakra_m * 0.05)> chakra_m, 
    chakra_m, 
    chakra +(chakra_m * 0.05)
  ) 
WHERE 
  `referencia` NOT IN (
    (
      SELECT 
        `jogador` 
      FROM 
        `batalha_npc`
    ), 
    (
      SELECT 
        `jogador_1` 
      FROM 
        `pvp_combates`
    ), 
    (
      SELECT 
        `jogador_2` 
      FROM 
        `pvp_combates`
    )
  )

The problem basically is NOT IN that does not query two tables and returns 0 always, are two distinct tables, that of "Combat against the computer" and "Against other players" not to cure them during combat.

  • 1

    if there are 2 different tables, should have a or with 2 not in, for example referencia not in (select ...) or referia not in (select outra tabela)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.