Your cart is currently empty!
MySQL: Select From Where?
Select from table
SELECT * FROM some-tbl;
Select from another query
SELECT * FROM (SELECT * FROM some-tbl) AS some-other-tbl;
WITH some-other-tbl AS (SELECT * FROM some-tbl) SELECT * FROM some-other-tbl;
Save query to a variable, and use that variable with another select
SELECT id INTO @somevar FROM some-tbl WHERE id = 2; SELECT * FROM some-other-tbl WHERE someid NOT IN (@somevar); SELECT * FROM some-other-tbl WHERE someid = @somevar;
Using the results of another query as a condition
SELECT * FROM some-tbl WHERE xxx IN (SELECT xxx FROM some-other-table);
Leave a Reply