Show only most recent date from joined MySQL table

后端 未结 5 1626
抹茶落季
抹茶落季 2020-12-28 20:16

I have 2 tables, a \"document\" table and a \"content\" table. They look like this (simplified):

document table:
docID
docTitle

content table:
contentID
doc         


        
5条回答
  •  鱼传尺愫
    2020-12-28 20:41

    This is a 2 query solution:

    First query:

    select docID, max(dateadded) from [TblContent] group by docID
    

    Second query:

    select [TblDocument].* from [TblDocument]  
    inner join [TblDocument] on [TblDocument].[Docid]=[FirstQuery].[DocID]
    

提交回复
热议问题