SELECT * FROM users WHERE user_id IN ( SELECT user_id FROM old_users )
Here is another example of something that MySQL can't do that you may want to do:
SELECT * FROM users, articles, comments WHERE users.id = articles.user_id AND users.id = comments.user_id
Note, MySQL 4 will be able to do both of these queries. MySQL 3 (the one shipped with RedHat) cannot.
If you don't plan to relate too many tables together, MySQL 3 rocks. It's super fast and can handle huge amounts of data. If you have a "highly relational" schema in mind, then you may want to choose Postgres or some other relational DB.
--Dave
Phillip Hellewell wrote:
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.)
____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
