Mark Tabor

Mark Tabor

  • 589
  • 2k
  • 460.1k

How to get data from two tables in sql

Jun 9 2016 6:17 AM
I have two tables User and UserFiles  as shown below
 UserId    Name EMaIL Password Phone
 1 First    [email protected] 12346456456456
 2 second    [email protected]    11123523235
 
User Files table Below
 RecordId(primary) UserID(Foreign)FileName  PublihsedByDate 
 1 1 First.DOc A 1/1/2001
 2 1 second.doc B 1/1/2012
 3 1 Third.Doc B 1/1/2016
 4 2 G.PDF B 1/1/2014
 
as you can see against one user id we have multiple files like for userid=1 we have three files I want to get the record with latest file inserted in our case i want to get the
Third.Doc how to achieve that  

Answers (4)