Possible Duplicate:
Can you define “literal” tables in SQL?
Occasionally I find myself in a situation where I'd like to join an existing table to a table of values that are entered in the query. Something like:
SELECT ((1,2,3),(4,5,6));
Where the query would return two rows of 3 columns. Obviously this syntax is not correct, but it is possible to generate a single row of data in this way. For example:
SELECT 1,2,3;
Is there actually a way to do what I'm trying to achieve?
Select all duplicate MySQL rows based on one or two columns? For this, use subquery along with HAVING clause. Let us first create a table − Following is the query to select all duplicate rows based on one or two columns.
mysql - Selecting Multiple Rows in One Query with Multiple Conditions - Database Administrators Stack Exchange I can select multiple rows with one condition by using something like: SELECT `Col`, `Col2` FROM `Table` WHERE `Col3` IN (?, ?, ?, ?, ?);
A single query will select from 10 to 100 rows (though most of the time it'll be only 10)- it has to be fast in terms of performance. This is why using multiple queries isn't a good idea. The CREATE TABLEstatement is:
What is the correct way to select multiple rows? fetch_row () does exactly what its name suggests: it fetches a single ROW. You're looping on the individual fields in that row. Use a while loop with your myslqi_fetch_row () function.
SELECT 1,2,3
UNION ALL
SELECT 4,5,6;
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