How to select two or more element in SQL table?

Please note I’m a beginner in SQL and PHP and I search =every where but didn’t found anything useful I want to select two data from the following table. id name 1 Joe 2 John my code else if($_SESSION[‘name’]==’Joe’) I tried use this syntax but didn’t work ==’Joe’, ‘John’, ==(‘Joe’, ‘John’) Please help me >Solution… Read More How to select two or more element in SQL table?

If I launch this insert twice

If I launch this insert twice, it adds duplicate products to me. how do I add if something has changed? INSERT INTO db1 ("Drink") VALUES (‘Cola’), (‘Rom’), (‘Sprite’), (‘Fanta’), (‘Vodka’); >Solution : INSERT INTO db1 ("Drink") select drinks.drink from ( VALUES (‘Cola’), (‘Rom’), (‘Sprite’), (‘Fanta’), (‘Vodka’) ) as drinks(drink) where not exists (select 1 from… Read More If I launch this insert twice

SQL How do I get highscore and number of rows as attempts

I have 2 tables PLAYERS and GAMES When a new game starts, I add a new GAME record with a playerID to the database, so the data might look like this: GAMES Id  Score PlayerId 1   200    10 2   100    10 3   500    10 4   100    11 5   200    11 Question: How do I query this if I want to get the highest score and sum of… Read More SQL How do I get highscore and number of rows as attempts

How to select from table where value from another table is greather than some value?

How could I select * from table movies where seeds > 10 in table torrents? Table movies has unique id, while table torrents has id that matches the movie id. There are few torrents for each movie and having just one that has seeds greather than 10 should be selected. The only sql I have… Read More How to select from table where value from another table is greather than some value?

FIND_IN_SET() After checking the id's it's acting like it's two different posts

Here is the DEMO for better understand what is the issue. The following sql query prints only the ones with the mp3 value of the uploaded_file_ext in the i_user_uploads table. As can be understood from the query, the data in i_user_uploads is taken from the post_file ids in the i_posts table. I need to make… Read More FIND_IN_SET() After checking the id's it's acting like it's two different posts