Code: Select all
$query = "SELECT id, blah blah blah FROM table (WHERE id!=3 LIMIT 5) AND blah blah AND blah blah LIMIT 20";Moderator: General Moderators
Code: Select all
$query = "SELECT id, blah blah blah FROM table (WHERE id!=3 LIMIT 5) AND blah blah AND blah blah LIMIT 20";Code: Select all
SET @mycount :=0;
SELECT *
FROM `table`
WHERE IF (
id =1, @mycount := @mycount +1, @mycount := @mycount +0
)
AND @mycount < 3
ORDER BY category_id;Please notice that without an ORDER BY clause, LIMIT doesn't make much sense..So essentially, I just want the first 3 records that match my (id!=3) where conditional to be knocked off but allow the rest to be included in the results. I hope this makes sense because this has been hard trying to put into understandable words! Thanks for your time and efforts! Take care.
Code: Select all
SELECT id, blah blah blah
FROM table, blah blah blah , blah blah
WHERE id NOT IN (
SELECT id
FROM something
WHERE id = 3
LIMIT 3
)
LIMIT 20There's no such thing as a SELECT without an ORDER BY clause. Not specifying it is the same as using the default order on the table.timvw wrote:Please notice that without an ORDER BY clause, LIMIT doesn't make much sense..