Answers interspersed... Laszlo Thoth <[EMAIL PROTECTED]> wrote on 10/12/2004 01:46:08 PM:
> Quoting [EMAIL PROTECTED]: > > > Good, you recognize the need to perform two separate aggregates (GROUP > > BYs) and compare the separate results... In fact, you may need two temp > > tables so that you can (INNER / LEFT) JOIN one to the other. (Yes, I can > > think of a query that works without the second temp table but I think it's > > kludgey and would rather not post it.) > > > > To find same name and count > > > > CREATE TEMPORARY TABLE tmpCount1 > > I've been staying away from TEMPORARY TABLEs for two reasons: > > 1) irrational fear of the unfamiliar Understandable. > > 2) safety: not being exactly sure what happens if two clients try to create a > TEMPORARY TABLE by the same name at the same time Temporary tables are connection-specific. Unless you have two processes that share a common connection try to create the same named temporary table, there should be no problem. You can test this for yourself. Create two separate connections to your MySQL database (I am on win2K and used the MySQL command line client in two separate shells). Create a temporary table in one of them. Now try to affect it from the other. Pretty cool, eh? > > 3) not being exactly sure what happens if my client is killed before I can DROP > TEMPORARY TABLE and I end up with millions of temporary tables filling up my > disk. Temporary tables are connection-specific. When the connection dies, the table is destroyed for you automatically. However, I always try to kill my temp tables before I drop my connection just to make sure that those resources can be reused as soon as possible. Shawn Green Database Administrator Unimin Corporation - Spruce Pine