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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:38:06+00:00 2026-05-25T09:38:06+00:00

It is serious matters: is it fault in Sql Query Analyzer?. I have face

  • 0

It is serious matters: is it fault in Sql Query Analyzer?.

I have face strange situation that I have tested following query on Sql Query Analyzer:

insert into PLCommonTotal(CmnTotal)
select
case
when p.NetpurTot > s.NetsalTot then
(
select NetpurTot from PLPurchaseTotal
)
else
(
Select NetsalTot from PLSaleTotal
)
end
from PLPurchaseTotal p
join PLSaleTotal s
on p.companyID=s.companyID

select * from PLCommonTotal

It is working very well no error from Sql Query Analyzer.

Now look at the same query in VS-2005 :

string tot5 = " insert into PLCommonTotal(CmnTotal)" +
                " select" +
                " case" +
                " when p.NetpurTot > s.NetsalTot then" +
                " (" +
                " select NetpurTot from PLPurchaseTotal" +
                " )" +
                " else" +
                " (" +
                " Select NetsalTot from PLSaleTotal" +
                " )" +
                " end" +
                " from PLPurchaseTotal p" +
                " join PLSaleTotal s" +
                " on p.companyID=s.companyID";
            SqlCommand comcmd = new SqlCommand(tot5, con);
            comcmd.Transaction = trans;
            comcmd.ExecuteNonQuery();

This is throw Sql Error : “ subquery return more than one value. This is not permitted when the subquery follows = != < <= > >= or when the subquery used an expression. The statement has been termited”.

I want to ask the question if it is not permitted than why it is executed from SQL Query analyzer without any error?.

Is there fault of SQL Team?.

  • 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-25T09:38:06+00:00Added an answer on May 25, 2026 at 9:38 am

    As you have written the query this will happen if you have more than one row in either PLPurchaseTotal or PLSaleTotal. I think that you are not using the same DB in SSMS and in VS-2005.

    On the other hand i suspect that this is the query you are aiming for.

    insert into PLCommonTotal(CmnTotal)
    select
      case
        when p.NetpurTot > s.NetsalTot
        then p.NetpurTot
        else s.NetsalTot
      end
    from PLPurchaseTotal p
      join PLSaleTotal s
        on p.companyID=s.companyID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a serious problem with getting data from a sql query in php
I have a quite serious performance issue with the following statement that i can't
I'm a serious newbie in JS, and I have this function that changes div
Actually I have a serious problem : I saw that somebody has accessed my
Starting my first serious GUI app in C#. I have a class that is
I got a serious problem here: I have a scrolling background that is 1320
I am having serious performance issues with a spatial update query in SQL Server
I have a serious doubt on using GWT. GWT claims that the client codes
I have a serious probleam with my Eclipse Plugin.. My plugin depends on another
I have a serious problem. One of our servers crashed. Now I reinstalled the

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.