mardi 4 août 2015

unable to group by category and unixtime desc

I have created: http://ift.tt/1SHCd5C

CREATE TABLE if not exists tblA
(
id int(11) NOT NULL auto_increment ,
userid int(255),
 category int(255),
  unixtime int(255),
 PRIMARY KEY (id)
);


INSERT INTO tblA (userid,category,unixtime) VALUES
('1', '1','1438689946'),
('1', '2','1438690005'),
('1', '3','1438690007'),
('5', '1','1438690009'),
('2', '1','1438690005'),
('2', '1','1438690398'),
('1', '2','1438691020'),
('1', '3','1438691028'),
('4', '2','1438690005'),
('2', '3','1438691025'),
('2', '2','1438691020'),
('3', '3','1438691022');

and

Select * from tblA  group by category order by unixtime  desc;

But I am getting wrong values.The values do not contain right unixtime desc.How can I make it work ? I really appreciate any help.

Aucun commentaire:

Enregistrer un commentaire