kapec gan ne Posted June 5, 2011 Report Posted June 5, 2011 mysql> select * from `table`; +----+--------+ | id | name | +----+--------+ | 1 | aaaaaa | | 2 | bbbbb | | 3 | ccccc | | 4 | ddddd | | 5 | eeeee | | 6 | wwwww | | 7 | ggggg | | 8 | hhhh | | 9 | uuuu | | 10 | iiiii | | 11 | gggg | | 12 | dddd | | 13 | sssss | | 14 | aaaaa | | 15 | jjjj | | 16 | uuuuu | | 17 | rrr | | 18 | mmmmm | +----+--------+ vajag izvadīt visu šo izvadīt html selectā, bet tā, lai piem. ieraksts ar `name`='hhhh' būtu pirmais un pēc tam pārējie tikai.
yancho Posted June 5, 2011 Report Posted June 5, 2011 Ja neesmu pārkarsis saulītē, tad SELECT * FROM `table` WHERE `name` = 'hhhh' UNION SELECT * FROM `table`
kapec gan ne Posted June 5, 2011 Author Report Posted June 5, 2011 (edited) Ja neesmu pārkarsis saulītē, tad SELECT * FROM `table` WHERE `name` = 'hhhh' UNION SELECT * FROM `table` jā UNION bija pareizā atbilde :) Edited June 5, 2011 by kapec gan ne
Recommended Posts