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 7078115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:30:25+00:00 2026-05-28T06:30:25+00:00

I have type column in my table, type column value is HOT and NOT

  • 0

I have type column in my table, type column value is HOT andNOT. from that i want to display HOT and NOT values of the column in to one line.

Example

Table1

Period ID Total

11/2011 101 250
12/2011 102 350
11/2011 103 450
....

Table2

Period ID Type Value

11/2011 101 NOT 500
11/2011 101 HOT 200
12/2011 102 NOT 300
12/2011 102 HOT 200
....

I want to display type (Hot and Not) in to one line

Expected Output

Period ID NOT HOT Total

11/2011 101 500 200 250
12/2011 102 300 200 350
11/2011 103 300 400 450
....

How to make a query.

  • 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-28T06:30:26+00:00Added an answer on May 28, 2026 at 6:30 am

    If I can assume that table1 has a primary key of (Period, ID) and table2 has a primary key of (Period, ID, Type), then you can do:

    select
        t1.period
        , t1.id
        , t2n.value [not]
        , t2h.value [hot]
        , t1.total
    from
        table1 t1
        left join table2 t2n
            on t1.period = t2n.period
            and t1.id = t2n.id
            and t2n.type = 'Not'
        left join table2 t2h
            on t1.period = t2h.period
            and t1.id = t2h.id
            and t2h.type = 'Hot'
    

    This will retrieve all rows from table 1, with their corresponding “not” and “hot” counterparts, respective to t2n and t2h above.

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

Sidebar

Related Questions

i have a table that has following column Type -------- type 1 type 2
I have an oracle table with a column from type SYS.XMLTYPE and a storage
I have a table column that uses an enum type. I wish to update
Can I have a column in my values table (value) referenced as a foreign
I have a table that contains a column that is XML data type. I
In a table column, I have this value: DV-2011-01-000004 (the data type is varchar2)
From my experience I have learn that using an surrogate INT data type column
i have a table column called status - data type is boolean. i want
I have created a table that has a strongly type XML column in SQL2008
I have a table with a coloumn of type time, and the values in

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.