Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6184781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:35:47+00:00 2026-05-24T01:35:47+00:00

I have a table as given below RMG Date Value YA 11/02/2001 94 YB

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:35:48+00:00Added an answer on May 24, 2026 at 1:35 am

    How can I find the matching dates to put it into in(…)?

    The pivot_in_clause of select appears to accept a subquery, such as this:

    select distinct(Date) from DbTable
    

    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 List of unique dates from DBTable. The list is suitable for constructing the IN clause of the pivot.

    private static List<Date> getDates(Connection conn) throws SQLException {
        List<Date> list = new ArrayList<Date>();
        StringBuilder sb = new StringBuilder();
        Statement st = conn.createStatement();
        st.execute("select distinct(Date) from DbTable");
        ResultSet rset = st.getResultSet();
        while (rset.next()) {
            list.add(rset.getDate(1));
        }
        return list;
    }
    

    Addendum: Additional guidance may be found in the JDBC™ Database Access tutorial and the Oracle® Database JDBC Developer’s Guide.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with data as given below: DATE Price ---------- ------ 31/12/2009
I have a table defnition as given below: License ClientId Type Total Used ClientId
Suppose I have a table MYtable as given below: ID A B C 1
I have a table that contains some data given below. It uses a tree
I have a table given below PSR exon 3311421 E11 3311422 E11 3311423 E11
Hi I have a table test its structure is given below: **Testing** PK C1
I have a organization name table with the following structure given below: CREATE TABLE
I have got table as given below in database: Name Grade Subject Ami HD
I have a student marks table with schema as given below: Student -------- SNO
I have 10 tables in my database(MySQL). two of them is given below tbl_state

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.