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

  • Home
  • SEARCH
  • 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 6544187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:26:09+00:00 2026-05-25T11:26:09+00:00

I have the following SQL query: Declare @Total_SysDown as int, @Login_SysDown as int Set

  • 0

I have the following SQL query:

Declare @Total_SysDown as int,
        @Login_SysDown as int



Set @Total_SysDown =    (SELECT SCHED_SYS_DOWN FROM AGT_SC AS S)
Set @Login_SysDown =    (SELECT SYS_DOWN FROM AGT_AC AS A)


Insert Into dbo.DATA(DATE,ID,LNAME,FNAME,Total_SysDown,Login_SysDown)
Select C.DATE,C.ID,E.Last_Name,E.First_Name,@Total_SysDown @Login_SysDown
From dbo.AGT as C Inner Join dbo.EMP as E ON C.ID = E.ID 
Group by C.ID,C.DATE,E.Last_Name,E.First_Name

This or just the variables with the Select statement gives me an error of Subquery returned than 1 value. From what I understand, this means that I should be inserting one record at a time, but I am unsure how to do this. Is there a while statement I should be putting in, or are my variables actually hindering me in the first place?

  • 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-25T11:26:09+00:00Added an answer on May 25, 2026 at 11:26 am

    At least one of the queries:

    (SELECT SCHED_SYS_DOWN FROM AGT_SC AS S)
    (SELECT SYS_DOWN FROM AGT_AC AS A)
    

    returns more than 1 row, so you cannot assign it to a scalar variable.

    As a temporary solution you can do SELECT TOP 1 to make sure each query returns at most one row.

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

Sidebar

Related Questions

I have the following SQL query: select expr1, operator, expr2, count(*) as c from
I have a following SQL QUERY: SELECT articles.name, articles.price, users.zipcode FROM articles INNER JOIN
I have an SQL query that takes the following form: UPDATE foo SET flag=true
I have the following SQL-statement: SELECT DISTINCT name FROM log WHERE NOT name =
I have the following query: DECLARE @sync_table_name nvarchar(500) SET @sync_table_name = 'ContactTypes' DECLARE @sync_batch_size
I have the following query: create proc [dbo].GetCustById as DECLARE @sql nvarchar(500) DECLARE @Param
I have the following sql query for transforming data but is it possible to
I am debugging some code and have encountered the following SQL query (simplified version):
I have the following Linq to SQL query, in which I'm trying to do
I have the following query in iSeries SQL which I output to a file.

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.