PHP + Mysql complicated SQL SELECT query -


i thought how make complicated (as think) select query table 3 kind of comments (first - positive comments, second - negative comments , third - neutral comments). using php select , diplay first negative comments, , right after negative comments diplay other type of comments. how diplay them 1 select query limit use separate pagination?

example of table:

id - unique id  type - (value 1-positive, 2-negative, 3-neutral)  text - value 

i thought first select * comments type='2' order id limit 0,100

while(){  ...  } 

right after second

select * commetns type!='2' order id limit 0,100  while(){  ...  } 

but how use limit pagination if there 2 different select queries?

use if statement in order clause change type 2 sort first:-

select * comments order if(type = 2, 0, type) limit 1, 20 

this give negative (type 2) comments first, followed other comments (whether positive or neutral). want add column sort consistency of display.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -