how to use 'inner join' and 'order by' in sql

  • A+
Category:Languages

I want to use inner join and order in my query in php page.
My query :

select      *  from      table1  inner join      table1category      on table1.table1category_id = table1category.id order by updateDate desc; 

'updateDate' is for table1 => error : Column 'updateDate' in order clause is ambiguous

 


when there is same column in two table then you've to specify the table name with that columns

SELECT   * FROM table1 INNER JOIN table1category   ON table1.table1category_id = table1category.id ORDER BY table1.updateDate DESC; 

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: