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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:41:53+00:00 2026-05-22T16:41:53+00:00

I have a table named tblAccount where I have two columns: DateCreated AccountApprovalDate DateCreated

  • 0

I have a table named tblAccount where I have two columns:

  1. DateCreated
  2. AccountApprovalDate

DateCreated is the date on which the account is created and AccountApprovalDate is the date on which the account is approved.

I need to create a column named ‘AccountApproval/RejectDate’. Here the Reject Date is a derived value.(i.e).There is a table named tblDeclinedaccounts,When accountId is there in this table then select the DateCRetaed column.
This column can have only approval date or reject date.
When AccountApprovalDate is not null, then the value is same. and when reject date is not null then we need to select Datecreated column.
i wrote the following query:

SELECT AC.Datecreated, 'Approved/Rejected Date' =
    CASE
        WHEN AC.AccountApprovalDate IS NOT NULL THEN 
            (SELECT AC.AccountApprovalDate)
        WHEN AC.AccountApprovalDate IS NULL THEN 
            (SELECT DA.Datecreated 
             FROM tblDeclinedAccounts DA 
             INNER JOIN tblAccount AC ON DA.AccountID = AC.AccountID where DA.AccountID IS NOT NULL)

    END
FROM tblAccount AC

I got error on executing:

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

This needs to be a sub 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-22T16:41:54+00:00Added an answer on May 22, 2026 at 4:41 pm

    Why does it need to be a subquery? Just join and use COALESCE:

    SELECT ac.accountid, COALESCE(ac.approvaldate, da.datecreated) as 'Approved/Rejected Date'
    FROM tblAccount ac
    JOIN tblDeclinedAccounts da
    ON da.Accountid = ac.Accountid;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table named Books which contains 3 columns. TableName: Books Columns: BookId
I have a table named Grades which contains 2 columns: Name and Grade. I
I have a table named OT Hours which has the following column EmpId, Date,
I have one table named test which has 3 columns: Name id address After
I have this table named OrdersToCall Data types: All bigints, except for date which
Lets say I have table named Place with columns: placeId int not null auto_increment,
I have a table named tbl_Subjects_Taken which lists all the subjects taken by the
I have a table named scores with the columns id and score . I
I have a table named with Sales having the following columns: Sales_ID|Product_Code|Zone|District|State|Distributor|Total_Sales Now i
I have table named 'testing' of 3 columns i.e. user,score,time in that 'time' is

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.