andrisp Posted June 16, 2005 Report Share Posted June 16, 2005 datums1 | datums2 | statuss --------------------------------------- 2005-06-12 | 2005-07-12 | 0 2005-06-11 | 2005-07-11 | 0 2005-06-10 | 2005-07-10 | 1 2005-06-09 | 2005-07-09 | 0 mysql_query("SELECT * FROM `table` ORDER BY datums1 ASC"); kverijs shobriid izskataas shaads, bet vajag, lai rindai, kurai statuss ir 1, kaartojot tiktu njemts nevis datums1, bet datums2 .. varat paliidzeet ? paldies Link to comment Share on other sites More sharing options...
Kristabs Posted June 16, 2005 Report Share Posted June 16, 2005 select * from table where statuss = '1' order by datums2 Link to comment Share on other sites More sharing options...
andrisp Posted June 16, 2005 Author Report Share Posted June 16, 2005 select * from table where statuss = '1' order by datums2 18579[/snapback] nje nje nje - tad jau tiks panjemts tikai tas, kam statuss ir 1, bet vajag lai njem visus, bet tiem ierakstiem, kuriem statuss ir 1, par kaartoshanas kriteeriju tiek njemts datums2 Link to comment Share on other sites More sharing options...
bubu Posted June 16, 2005 Report Share Posted June 16, 2005 SELECT * FROM `table` ORDER BY IF(statuss='1', datums2, datums1) ASC Link to comment Share on other sites More sharing options...
andrisp Posted June 16, 2005 Author Report Share Posted June 16, 2005 SELECT * FROM `table` ORDER BY IF(statuss='1', datums2, datums1) ASC 18583[/snapback] paldies, tieshi laikaa Link to comment Share on other sites More sharing options...
Recommended Posts