0

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)!

3
  • In your result 1991 comes after 2002. How is this sorted by year? Commented Sep 27, 2015 at 17:41
  • Also other than your try what are the original data to be sorted ? Commented Sep 27, 2015 at 17:41
  • I want to sort first by year 1991-2002 and then by Name for every Name Commented Sep 27, 2015 at 17:45

2 Answers 2

1

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

Something like this will sort by writer within year.

Sign up to request clarification or add additional context in comments.

2 Comments

@androidgame2014 okay.. but ur question shows something different.. just opposite.
Right androidgame2014, like @Deepak Sharma said if that's what you meant to write.
0

@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;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.