I've a table named gst that contain
CREATE TABLE gst (
gst_id INT PRIMARY KEY AUTO_INCREMENT,
month VARCHAR(9) NOT NULL,
price INT NOT NULL
);
INSERT INTO gst
(gst_id, month, price)
VALUES
( 7, February, 3),
( 16, January, 5)
( 17, April, 7),
( 18, March, 2),
I want to display a result in the order of month (ie january, february, march.........):
16 January 5 7 February 3 18 March 2 17 April 7
How can I write the sql query?
Try this....
SELECT DATE_FORMAT(date_col, '%M') as month FROM table ORDER BY month
Try this link also...