I need to select multiple records
I use
SELECT * FROM `table` WHERE `ID` =5623 OR `ID` =5625 OR `ID` =5628 OR `ID` =5621
this query runs 4 times per second with php
is there a better and faster way for this ?
Multiple row subquery returns one or more rows to the outer SQL statement. You may use the IN, ANY, or ALL operator in outer query to handle a subquery that returns multiple rows.
To select multiple columns from a table, simply separate the column names with commas! For example, this query selects two columns, name and birthdate , from the people table: SELECT name, birthdate FROM people; Sometimes, you may want to select all columns from a table.
SELECT * FROM `table` where ID in (5263, 5625, 5628, 5621)
is probably better, but not faster.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With