What's going on at Mysql?? When can we expect 3.23.50??? Balteo. ----- Original Message ----- From: Rodrigo Pérez <[EMAIL PROTECTED]> To: < > Sent: Sunday, May 05, 2002 11:32 PM Subject: Re: Optimization
> Thanks Jay, > Actually what i want to do is much more simple. I want to have on the same > query result, the first 10 rows with this word and the total of rows from > the table with this specific word. > > The result should be like a search engine page result. Has the total of > pages with that word and the first 10 results. I want to put it together in > only one query. Is it possible ? > > SELECT COUNT(*) from TABLE where name="JOHN" > SELECT * from TABLE where name="JOHN" limit 10 > > Thanks, > Rodrigo > ----- Original Message ----- > From: "Jay Blanchard" <[EMAIL PROTECTED]> > To: "'Rodrigo Pérez'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, May 03, 2002 2:23 PM > Subject: RE: Optimization > > > > [snip] > > I want to optimize one of my php scripts to acess mysql only once. Is > there > > anyway to put these two queries together: > > > > SELECT COUNT(*) from TABLE where name="JOHN" > > SELECT * from TABLE where name="JOHN" limit 10 > > [/snip] > > > > try > > > > select *, > > sum(if(name = 'JOHN', 1, 0)) AS COUNT > > from table > > where name = 'JOHN' > > group by name > > > > HTH! > > > > Jay > > > > > > > > --------------------------------------------------------------------- > > Before posting, please check: > > http://www.mysql.com/manual.php (the manual) > > http://lists.mysql.com/ (the list archive) > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php