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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:29:00+00:00 2026-06-11T02:29:00+00:00

insert into tableA (column1) select min(tableC.column1) from tableB inner join tableC on (tableC.coumn2 =

  • 0
 insert into tableA (column1) 
 select min(tableC.column1)
 from tableB 
 inner join tableC on (tableC.coumn2 = tableB.column1
 and tableB.column2 = tableA.column2) 
 group by tableA.column2

How would I change the above to a update with group by instead of insert with group by based on the criteria tableB.column2 = tableA.column2 ?

Note that I am using SQL SERVER 2008.

  • 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-11T02:29:02+00:00Added an answer on June 11, 2026 at 2:29 am
      Update A set Column1 = minC    
        from (select Ab.Column2, min(C.Column1) as minC
                from A Ab
                inner join B on Ab.Column2 = B.Column2
                inner join C on C.column2 = B.Column2 --No need to add again the A.col2 = B.col2
                group by Ab.Column2) Grouped where A.Column2 = Grouped.Column2
    

    Is this what you want?
    This will get for each columnA the C.Column1 min value, and will update it in A.Column1 (that’s where you were inserting before), based on condition A.Column2 = Grouped.Column2.

    here is a SQL-Fiddle Demo

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

Sidebar

Related Questions

PROCEDURE add_values AS BEGIN INSERT INTO TableA SELECT id, name FROM TableC (This selection
I want to accomplish something of the following: Select DISTINCT(tableA.column) INTO tableB.column FROM tableA
I'm writing SQL (for Oracle) like: INSERT INTO Schema1.tableA SELECT * FROM Schema2.tableA; where
Is there any performance benefits in INSERT INTO table1( column1) select * from table2;
I want to do something like this: INSERT INTO TABLEA ( COLUMN1, COLUMN2, COLUMN
INSERT INTO table_a (col_tinyint, col_varchar) SELECT 0, distinct(col_other_varchar) COLLATE utf8_bin FROM table_b I want
I'm running a pretty standard INSERT INTO [table] (col1, col2, ...coln) select * from
is there any similar syntax to this in mysql: insert into database2.table1 (column1, column2)
A) My way so far: sqlCommand.CommandText = INSERT Table1 ([column1],[column2],[column3]) + SELECT [column1],[column2],[column3] +
DECLARE @table table(XYZ VARCHAR(8) , id int) INSERT INTO @table SELECT '4000', 1 UNION

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.