**我需要以下表结构 投诉名称PhNo CreatedDate状态 PAC000019 Raja 9876543456 2016-01-15 11:13:17.747 FollowUp1 PAC000016 Raja 9876543456 2016-01-14 18:32:53.123已结束 PAC000010 Raja 9876543456 2016-01-14 18:05:04.703 FollowUp1** Main table structureComplainIdNamePhNo CreatedDate StatusPAC000010Raja98765434562016-01-14 18:05:04.703 FollowUp1PAC000016Raja98765434562016-01-14 19:29:36.530 FollowUp1PAC000016Raja98765434562016-01-15 11:10:07.170 FollowUp2PAC000016Raja98765434562016-01-14 18:32:53.123 ClosedPAC000019Raja98765434562016-01-15 11:13:17.747 FollowUp1**I need the following table structureComplainIdNamePhNo CreatedDate StatusPAC000019Raja98765434562016-01-15 11:13:17.747 FollowUp1PAC000016Raja98765434562016-01-14 18:32:53.123 ClosedPAC000010Raja98765434562016-01-14 18:05:04.703 FollowUp1推荐答案嗯,这很简单!试试这个Well it's pretty simple! Try thisSELECT *FROM( SELECT ComplainId, MIN(CreatedDate) MIN_DATE FROM MAIN_TABLE GROUP BY ComplainId) T INNER JOIN MAIN_TABLE M ON T.ComplainId = M.ComplainId AND T.MIN_DATE = M.CreatedDate 这篇关于在sql查询中需要不同的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-07 07:20