0

I have two tables :

               Table1

    id  |  name  |  age |  d_o_b  
=====================================
    1   |  ASD   |  22  |  12/01/1992  
    2   |  QWE   |  21  |  04/04/1993  
    3   |  FRG   |  24  |  04/04/1990


   Table2

    id  |  age
===============
    1   |  22  
    2   |  21
    3   |  24  

Is it possible to order by two columns one from first Table1 and then by one column from Table2.

Something like ..

SELECT * FROM Table1 order by d_o_b , age in (SELECT * FROM Table2)
Deepak Sharma
  • 456
  • 4
  • 15

1 Answers1

1

To order by a column in other table you may need to join them. This should work:

SELECT a.* FROM Table1 a
join table2 b
on a.id=b.id
order by d_o_b,b.age
Jayvee
  • 10,670
  • 3
  • 29
  • 40