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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:31:10+00:00 2026-06-11T12:31:10+00:00

I have two tables customer and activation that I would like to join. Here

  • 0

I have two tables “customer” and “activation” that I would like to join. Here are their structures:

 CUSTOMER                       Activation
 ------------                  ------------- 
 Id      Name                   EntityId       Date_Created       Type
 1       A                         1               2012            EMAIL
 2       B                         2               2011            SMS
 3       C

Now, I would like to join those two tables on customer.Id = Activation.EntityId. However, i want my final table structure to be like this:

 Id    Name    Date_Email       Date_SMS       

 1      A        2012             NULL
 2      B        NULL             2011

Basically, the columns Date_Email and Date_SMS both come from Activation.Date_Created column. IF Activation.Type is EMAIL, i set Date_Email in my final result to Date_created and set Date_SMS to null. If Activation.type is SMS, i do it the other way.

What i have right now is this:

SELECT Customer.Id, Name, Date_Created AS Date_EMail, DATE_Created AS Date_SMS 
from Customer 
inner join Activation ON Customer.Id = Activation.EntityId;

Now, i need to make a If-else condition based on Activation.Type column. I am quite new to this and I have not been able to figure this out by googling. I am using Oracle XE database btw

Can someone help me with this? Thanks

  • 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-06-11T12:31:12+00:00Added an answer on June 11, 2026 at 12:31 pm
    SELECT Id, Name, A1.Date_Created as Date_Email, A2.Date_Created as Date_SMS FROM
    CUSTOMER C
    LEFT JOIN Activation A1 ON C.Id=A1.EntityID AND A1.Type='EMAIL'
    LEFT JOIN Activation A2 ON C.Id=A2.EntityID AND A1.Type='SMS'
    

    This also adds entity with ID=3, where Date_Email and Date_SMS are null. I don’t know Oracle’s syntax, you can remove the ID=3 with something like WHERE NOT (IsNull(Date_Email) && IsNull(Date_SMS))

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

Sidebar

Related Questions

I have two tables in my database that look like that: Customer: C_ID city
I have the following two tables: Customer { int Id int Name } Bills
Given that I have two tables Customer (id int, username varchar) Order (customer_id int,
I have two tables. One contains Potential Customer information along with their Vehicle requirements
I have two tables, Customer and CustomerConfiguration that should have a one-to-one mapping. What
For example, I have two tables. Name: Customer Primary key: idCustomer AnotherColumn: name Foreign
I have two tables one Employee and mailing Subscriptions Employee looks like this: Name
I have two tables, one with products and a foreign key for the customer.
I have two tables one with ID and NAME table 1 ID | NAME
I have two tables Customer (idCustomer, ecc.. ecc..) Comment (idCustomer, idComment, ecc.. ecc..) obviously

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.