1
Good night How I would ride this select 1 - entering the site the premium ads are above the free ones and all Rand -> OK but I need too. Selecting the city, only the state/city premium ads appear and below the free ones of this state/city. Like this my code:
SELECT * FROM estudio_ts ORDER BY estudio_premium DESC, rand()
this works correctly
SELECT * FROM estudio_ts WHERE estudio_uf = '$uf' OR estudio_cidade LIKE '%$city%' ORDER BY estudio_premium DESC, rand()
This works but puts all premium above, including other states/city
Honestly: I couldn’t understand what you want.
– anonimo
Order by (case when estudio_uf = '$Uf' then 0 Else 1 end),estudio_premium DESC, Rand()
– Motta
It didn’t change anything in the query.. but thank you very much anyway
– Bruno S. Ferreira
Anonym what I need is: I’ll try to explain otherwise... If I have ads all over Brazil, when the user enters the site, all the ads appear, being paid first.. But when the user enters the state of Rio de Janeiro, for example,,, It should only appear ads from Rio de Janeiro, first coming paid ads.. and not appearing paid and unpaid ads from other states... Writing this review I had an idea.. if it works I put the solution here.. Obg all the same
– Bruno S. Ferreira
Thanks guys.. I managed to do it that way. It might not be the right thing but it’s what I get at the moment.. , what I needed was.. user arrives at the site and appears ads from all states being paid first and random.. User selects state or city, only ads from that region will appear being paid first... I’m posting here because the site says q can no longer respond...
– Bruno S. Ferreira
Good.. the site here doesn’t let me answer.. because it has a low reputation.. I think this is it.. so I’m going to owe the resolution
– Bruno S. Ferreira