I have a table as given below
RMG Date Value
YA 11/02/2001 94
YB 11/02/2011 63
YC 11/02/2011 35
YA 12/02/2011 32
YB 12/02/2011 45
YC 12/02/2011 51
YA 13/02/2011 32
YB 13/02/2011 45
YC 13/02/2011 51
Based on requirement I want to extract common date and show it like
RMG 11/02/2011 12/02/2011 13/02/2011
YA 94 32 32
YB 63 45 45
YC 35 51 51
How can I achieve this using table in Java or by SQL. I have no background in database. I am confused what is the best approach to fix this.
The pivot_in_clause of
selectappears to accept a subquery, such as this:Addendum: If XML is unacceptable with a subquery, a separate query may be used to determine the distinct values required. As a concrete example, the following method will return a
Listof unique dates fromDBTable. The list is suitable for constructing theINclause of the pivot.Addendum: Additional guidance may be found in the JDBC™ Database Access tutorial and the Oracle® Database JDBC Developer’s Guide.