Yes. I want to retrieve 5 of each. If I put LIMIT 5, the entire query retrieves only 5 for table1.col2 with value of 1 because 1 is the first in the IN (1,2,3) clause.
If I put LIMIT 15, the query returns 15 rows same as above instead 5 for each 1, 2, and 3 values. This is because there are more than 15 rows in the table with value "1" in table1.col2. The query will start with table1.col2 with value of "2" only when the number of rows with the value ("1") are exhausted and the limit is more than the count. ~Jay --- Michael Stassen <[EMAIL PROTECTED]> wrote: > Why do you think it doesn't work with LIMIT? Do you > want 5 of each? > > Michael > > Jay K wrote: > > > Hi, > > > > I have multiple queries like this: > > > > SELECT col1, col2, col3, col4 FROM table1, table2 > > where table1.col1 = table2.col1 and table1.col2 = > 1 > > ORDER BY col3 desc LIMIT 5 > > > > and > > > > SELECT col1, col2, col3, col4 FROM table1, table2 > > where table1.col1 = table2.col1 and table1.col2 = > 2 > > ORDER BY col3 desc LIMIT 5 > > > > The only difference is in the WHERE clause > table1.col2 > > = x. > > > > I would like to have one statement instead of > multiple > > statements and though about using IN clause like: > > > > SELECT col1, col2, col3, col4 FROM table1, table2 > > where table1.col1 = table2.col1 and table1.col2 IN > > (1,2,3) ORDER BY col3 desc LIMIT 5 > > > > It works without LIMIT, but I need to use the > LIMIT. > > > > Any help is appreciated. > > > > Thanks in advance, > > Jay > > > > > > > > _______________________________ > > Do you Yahoo!? > > Declare Yourself - Register online to vote today! > > http://vote.yahoo.com > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]