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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:30:13+00:00 2026-06-03T14:30:13+00:00

i have queries as these: update table1 set quantity=(quantity)+3 where productsid=1 update table1 set

  • 0

i have queries as these:

update table1 set quantity=(quantity)+3 where productsid=1
update table1 set quantity=(quantity)+4 where productsid=2
update table1 set quantity=(quantity)+5 where productsid=3
update table1 set quantity=(quantity)+6 where productsid=4
update table1 set quantity=(quantity)+1 where productsid=5
update table1 set quantity=(quantity)+3 where productsid=6
update table1 set quantity=(quantity)+2 where productsid=7

but i am working on sqlce i couldn’t send all queries, and send one for one
take much time, so i need a dynamic query, with it gets a only query with work as these queries. maybe using case?

  • 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-03T14:30:14+00:00Added an answer on June 3, 2026 at 2:30 pm

    problem was solved with 2 query and one loop for

    string query1 = " UPDATE table1  SET  quantity = CASE productsid  ";
    string query_where = "END  WHERE productsid IN ";
    

    after a loop for, query is it

    UPDATE table1  SET  quantity= CASE productsid  
    When '1' Then quantity  - 2.0000000000 
    When '2' Then quantity  - 2.0000000000 
    When '3' Then quantity  - 1.0000000000 
    When '4' Then quantity  - 1.0000000000 
    When '5' Then quantity  - 1.0000000000 
    When '6' Then quantity  - 5.0000000000 
    When '7' Then quantity  - 1.0000000000 
    When '8' Then quantity  - 1.0000000000 
    When '9' Then quantity  - 1.0000000000 
    END  WHERE productsid IN 
    (  
    '1',
    '2',
    '3',
    '4',
    '5',
    '6',
    '7',
    '8',
    '9'
    ) 
    

    and i could use ExecuteNonQuery(); and its all! only one query..

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

Sidebar

Related Questions

I have these 2 queries that I would like to combine into one big
I have these two queries to test my output SELECT DISTINCT( providerId ), SUM((
I have two queries. The first one is.. INSERT INTO balik ( balik_date, balik_time,
I have 14 LINQ queries to resolve in one method. None of them have
Situation I have 5 Access DB files, each one has 10 tables, 40 queries
Kind of an odd request, but is it possible to have seperate TSQL Queries
I have an UPDATE query where I explicitely reference the database, but MySQL still
I have a 5×7 HTML table. On many queries, there are fewer than 35
I'am using GWT 2.4 with Hibernate and RequestFactory and I have queries like this
I have two queries, as following: SELECT SQL_CALC_FOUND_ROWS Id, Name FROM my_table WHERE Name

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.