// create watos table CREATE TABLE WATOS ( id varchar(32) not null, question varchar(255) not null, question_short varchar(255) not null, isFor varchar(12) not null, time_created datetime, player1_selection int unsigned, player2_selection int unsigned, max_odds int unsigned, probability decimal(4,2) unsigned, winner int unsigned, time_completed datetime, primary key (id) ); // how to delete stuff delete from WATOS where question like '%hey%'; delete from WATOS where time_completed IS NULL; delete from WATOS where isFor IS NULL; // how to get the newest wato select * from WATOS order by time_created desc limit 1; // how to get the least probable winner select * from WATOS where winner='2' order by probability asc; select * from WATOS where winner='2' and isFor='Friend' order by probability asc; select * from WATOS where winner='2' and isFor='Friend' order by probability asc limit 1; // how to get all rows where player1_selection = player2_selection select * from WATOS where player1_selection=player2_selection and winner='1'; // get WATO of the day select * from WATOS where time_completed >= NOW() - INTERVAL 1 DAY and (isFor='Myself' and winner='2') or (isFor='Friend' and winner='1') order by probability asc limit 1; select * from WATOS where isFor='Friend' and time_completed >= NOW() - INTERVAL 1 DAY and winner='1' order by probability asc limit 1; select * from WATOS where isFor='Myself' and time_completed >= NOW() - INTERVAL 1 DAY and winner='2' order by probability asc limit 1;