Mysql
 sql >> Database >  >> RDS >> Mysql

INSERT con una condizione

Non è una domanda molto chiara, ma puoi utilizzare una query come questa:(non testato )

insert into pageview
  select 15, 'A VISITOR', 10, now() 
  from pageview a
  where id_realestate=10 and DATE_ADD(now(),INTERVAL -30 MINUTE) > (
      select max(news_release) from pageview b where a.id_realestate=b.id_realestate
  );