1

Hello everyone I have SQL database with 3 tables ( type,author,warehouse) and they are connected with IDs , I want a sort by Author in alphabetical order my tables .I have somthing written ,but not worked

public List<String> authorAlphabeticReference() {
Warehouse w1 = new Warehouse();
Collections.sort(warehouses,new TypeComparator());
List<String> w2 = new ArrayList<String>();
for(int i=0; i <warehouses.size(); i++) {
    w1 =  warehouses.get(i);
    if(w1.getAuthor().equals(w2))
        w2.add(w1);
}
Collections.sort(w2);
return w2;      
ernest_k
  • 44,416
  • 5
  • 53
  • 99
Joe
  • 11
  • 2
  • 5
  • If your data is in an SQL database, you should run a _query_ to obtain the rows in the order you require – you need not "sort them" yourself. – Mike Robinson Dec 15 '18 at 20:23

0 Answers0