Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Advice how to sort data from database

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Thanked 0 Times in 0 Posts

    Default Advice how to sort data from database

    I want to create a class, where I want to take a number of rows out of the database, which among others include what day that assignment should be done.

    I then want to sort the data after what day it is. For instance if it's currently Monday, the sorting should start with the rows where it says Monday and so on. The next day all the rows including monday goes in the back of the sorting. If it's Friday it starts with all data including Friday, then Saturday and so on. I assume you get my point?

    At last my gui components(a number of JLabels) should display this sorting accordingly to what day the program is opened.

    My problem is that I can't really seem to get started. What is the easiest way to approach this project? And is it more complicated than I initially assumed?

  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 833 Times in 772 Posts
    Blog Entries

    Default Re: Advice how to sort data from database

    Sort the data on the database side using and ORDER BY clause, use the appropriate Collections.sort() method (the Date class implements Comparable already), or write your own sorting algorithm.

Similar Threads

  1. how to searching data from database using servlet??
    By mr.nash in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: December 21st, 2011, 03:09 PM
  2. Replies: 0
    Last Post: November 6th, 2011, 03:55 PM
  3. multiple access to same data in database
    By the light in forum JDBC & Databases
    Replies: 1
    Last Post: August 23rd, 2011, 10:19 AM
  4. [SOLVED] Passing data to a MySQL database
    By JDyson in forum JDBC & Databases
    Replies: 1
    Last Post: December 1st, 2010, 01:31 PM
  5. [SOLVED] Get Data From Database MySQL using ComboBox
    By Simple in forum Java Theory & Questions
    Replies: 2
    Last Post: June 4th, 2010, 02:45 AM