androidgame2014
androidgame2014

Reputation: 61

SQL query (Sort by multiple columns)

I have a problem writing a specific query for my database I have a table with the following records:

[ID(PK),Writer,Title,Year,Description]

. I want to sort the records first per year and secondly per Writer for every Starting Letter(A-Z). So Have a result as this

Year     Writer  Title
1999       A1      X
1999       A1      Y
2001       A2      V
2002       A1      Z
1991       B1      P
2002       B2      Q
2003       B1      R

So at the end will be years at ASC form for every Letter of the Alphabet (Writer ASC)!

Upvotes: 0

Views: 54

Answers (2)

Deepak Sharma
Deepak Sharma

Reputation: 4170

@Larz Plutzin..

he want the record to be sort first by author then by year. check what he posted..

your query going to be like - may be he could not explain the written what he wants. but the result he wanted going to be like this only..

SELECT YEAR, WRITER, TITLE ORDER BY WRITER, YEAR;

Upvotes: 0

Larz Plutzin
Larz Plutzin

Reputation: 11

SELECT YEAR, WRITER, TITLE ORDER BY YEAR, WRITER;

Something like this will sort by writer within year.

Upvotes: 1

Related Questions