How can I limit the amount of results returned?
$images = $wpdb->get_col("
SELECT ID FROM $wpdb->posts
WHERE post_type="attachment"
AND ID in ($meta)
ORDER BY menu_order ASC
");
How can I limit the amount of results returned?
$images = $wpdb->get_col("
SELECT ID FROM $wpdb->posts
WHERE post_type="attachment"
AND ID in ($meta)
ORDER BY menu_order ASC
");
$images = $wpdb->get_col("
SELECT ID FROM $wpdb->posts
WHERE post_type="attachment"
AND ID in ($meta)
ORDER BY menu_order ASC
LIMIT 5
");
Like @Kaiser suggested you can specify a range (5th to 20th results, a total of 15 results are returned at max) like this:
$images = $wpdb->get_col("
SELECT ID FROM $wpdb->posts
WHERE post_type="attachment"
AND ID in ($meta)
ORDER BY menu_order ASC
LIMIT 5,20
");