-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > Hi, > > I'm planning to write a PHP/MySQL budget manager. I seem to > remember hearing something about MySQL's inability to do subselects. > What exactly _is_ a subselect? Is it like a join? > > Anyway, I'd hate to get almost finished and then realize I can't do > what I want because no subselects. If I need them I'll just use > PostgreSQL from the start. > > Thanks, > Phillip > > P.S. No, I haven't taken CS 452 yet :) (But I did some database > programming 7 years ago.)
A subselect (or subquery) is a query within a query, something like this: SELECT foo FROM bar WHERE baz IN (SELECT baz from othertable) or this: SELECT thingy FROM (SELECT * FROM table WHERE name LIKE "%otherthingy%") There are a couple of different ways to use subqueries. Often they can be replaced with a join, and, indeed, often the DBMS's query optimizer will do exactly that before executing the query. Subqueries are supported in MySQL 4.1 and (I think) in 4.0, but not in any version prior to that. -----BEGIN PGP SIGNATURE----- Version: PGP 8.0.2 iQA/AwUBPty0onNq1Kdl3W66EQI+hQCePzt0XmFoeDjUlpYqvjr/pMB5DLIAn2O0 z2DviD5sdtx4zeOdeqqctuNm =3v1L -----END PGP SIGNATURE----- ____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
