Quick note on CROSS JOIN
Example: If you want to retrieve a last row of information from a table, you could search for the max/highest row ID that has been created in that table to be sure that you are working against the latest one.
"SELECT tblOne.* FROM tblOne, (SELECT MAX(ID) as maxID FROM tblOne) maxresults WHERE tblOne.ID = maxresults.maxID"
It does not need to be the same table in the subquery. You can compare it against using a “table view” stored in the DBMS, it’s a good middle thing to use when you think the query is not quite big enough to be wanting to create a view for it.
It is not that often this method is needed, but there are times. When you need 2 subqueries in 1 query it’s called a CROSS JOIN.
Leave a Reply
Welcome to Thronic.com
Search this Site
Miscellaneous Links
Recent Articles
- Google-like search suggestion tool
- Linux Bash Color
- Resize a div layer with javascript
- Moving a div layer with javascript
- Web Galaxy » A sci-fi browser game
- Windows 7 on Asus Eee 900 PC
- IE and PHP sessions
- Wordpress 2.8.6 Spell Check Languages
- Reset MySQL Root Password
- Linux hosts file
- IdleGuard
- Column count in SQL
- String encryption in PHP
- Alphanumeric Captcha values in PHP
- Your own numeric Captcha in PHP
