find minimum datetime while using forieg key in two different table

Last Reply 5 days ago By dharmendr

Posted 7 days ago

I have 2 tables with name [COURSE] and [TEST]. COURSE table having columns ID,Name. [TEST] table contains ID,CourseID(Foriegn key i.e. ID in COURSE table),DATETIME,NUMBERS. example:suppose COURSE table with ID 1,2(only 2 column) and TEST table with 8 numbers of data having different datetime and CourseId 1(3 column),2(6 column)



I want to find the minimum DATETIME,CourseID and Name by joining this 2 table the below query giving a 2 output but i want a single query to find the single column??



    FROM [dbo].[TEST]
    left JOIN [dbo].[COURSE]
    ON [dbo].[TEST].CourseID=[COURSE].ID GROUP BY CourseID,Name)


You are viewing reply posted by: AnandM 6 days ago.
Posted 6 days ago

Hi manoj150,

Please provide the records for both the table and explain your requirement with excepted output.

I agree, here is the link: