I have this query:
$result = mysql_query("SELECT id,pic0,bio,url FROM ".$table." WHERE id LIKE '%custom%' || ( category IN ('cat1') AND model = 'bmw'");`
And I am displaying them in a loop like:
while ($slice = mysql_fetch_assoc($result)){ }
Is there a way to firstly display the records from: WHERE id LIKE '%custom%'
And after display the records from: || ( category IN ('cat1') AND model = 'bmw'");
Ty for your answer.
Here is an updated sql code which I did to be sure the duplicates are removed automaticly:
(
SELECT 1 AS sort_col, performerid, pic0
FROM `cronjob_reloaded`
WHERE performerid IS NOT NULL
)
UNION (
SELECT 2 AS sort_col, performerid, pic0
FROM `cronjob_reloaded`
WHERE performerid IS NOT NULL
AND category
IN (
'Girl'
)
)
ORDER BY sort_col
And they are not. The first select gets the same result as the select nr two, but mysql shows me all the rows combined.
you could use a union
edit: removed the warning about duplicates (according to mysql union docs, dupes are removed automatically), added sort_col to make sure the order is kept.