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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:05:48+00:00 2026-06-10T12:05:48+00:00

select b.b_id from btable b inner join atable a on b.b_id = a_id go

  • 0
select b.b_id from btable b inner join atable a on b.b_id = a_id
go
delete from btable where b_id in (...)
go
insert into btable select * from atable where a_id in (...)
go

The second and the third sql statement’s conditions are the first sql query result,

now I want to merge these three sql statement into single sql statement,

is there any way?

  • 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-10T12:05:50+00:00Added an answer on June 10, 2026 at 12:05 pm

    No, it’s not possible to do.

    PS: having all the 3 clauses in one statement barely would be called “query optimization”. Optimization is when you improve a query performance, not when you just take N queries and get them in a single query.

    Actually it’s a common misunderstanding among newbies – that the less queries automagically means they would perform faster. It’s just wrong. You should have as many queries as you need to retrieve all the necessary data – not less and not more.

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

Sidebar

Related Questions

mysql_query( SELECT b.id as b_id FROM banner b INNER JOIN bannerhits bl ON b.id
I have a SQL statement like the following: select A from table1, (select B
DELETE FROM table_a WHERE id IN( SELECT table_a.id AS id FROM table_a, table_b WHERE
I wanted to convert the following nested query into a join. query = INSERT
I'm having trouble optimizing this query: SELECT a.id FROM a JOIN b ON a.id=b.id
In the following query: SELECT column_a, column_b FROM table_a WHERE column_b IN (SELECT b_id
someone can explain me what this query does? $sql=mysql_query(SELECT b.id, b.data FROM data_parent a,
I have following sql query that take only 1 second to execute: select a.date,
I am using the following query in my database, SELECT b.sales_id,b.category_id,b.sale_starts,b.sale_ends FROM tbl_sales b
I've got a mysql query like this: SELECT A.ID, A.NAME, B.ID, B.NAME FROM table1

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.