string comparison for timestamp!

2011-10-30 Thread Hal�sz S�ndor
I was using this query and getting queer results: SELECT MemberID, Surname, Houshold, Houmuch, CASE WHEN Houmuch (SELECT sharePrice FROM Stock) THEN ADDDATE(ereStart, (Houmuch * (SELECT hwyl FROM Stock)) / (SELECT regularPayment FROM Stock)) ELSE TIMESTAMPADD(YEAR, 2, CURDATE()) END

Re: large temp files created by mysql

2011-10-30 Thread Jan Steinman
From: mos mo...@fastmail.fm At 10:34 AM 10/24/2011, you wrote: select id from table order by rand() limit 1; is doing as example a dumb temporary table with the full size Because it has to sort the entire table, then it returns the one row. This of course is extremely inefficient. :)

Re: large temp files created by mysql

2011-10-30 Thread Jan Steinman
Actually, having tried that, you still need the ORDER BY RAND() in there. Otherwise, I keep getting the same record over and over. But it surely cuts way down on the number of rows that need to be sorted. So if your table size is fairly stable, and you pick a good number for the WHERE