-1

How do I do this

How can I SELECT rows with MAX(Column value), DISTINCT by another column in SQL?

but with a different table? Table A has the date and table C has the ID I want to be distinct.

Thanks.

  • 2
    Welcome to Stack Overflow. Please take few moments to take a [tour] and also read [ask] to get better answers for your questions. – Marek Vitek Jul 12 '17 at 13:58

2 Answers2

0

use join for that two table and then use distinct.

0

Use GROUP BY statement instead of distinct for this.

SELECT t1.a, MAX(t2.a)
FROM t1
JOIN t2
    ON T1.id = t2.id
GROUP BY T1.a
Marek Vitek
  • 1,573
  • 9
  • 20