Mysql ve Özel Sıralama

Mysql'de özel sıralama nasıl yapılır diye bir arkadaşımın sorması üzerine araştırdım. Ve bulduğum örnek gayet başarılı.

Örneğin öncelik sırasına göre dizicez önceliklerimiz sırasıyla High , Normal , Low , The Abyss olacak. bunun için aşağıdaki gibi FIELD komutunu kullanıyoruz.

MySQL:
  1. SELECT * FROM tickets
  2. ORDER BY FIELD(priority, 'High', 'Normal', 'Low', 'The Abyss');

convert this post to pdf.
Etiketler : Mysql, , , , , , ,

Leave a Reply




*
To prove you're a person (not a spam script), type the answer to the math equation shown in the picture. Click on the picture to hear an audio file of the equation.
Click to hear an audio file of the anti-spam equation