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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:04:23+00:00 2026-06-13T17:04:23+00:00

I have 4 SQL queries that fetch data from the same table and I

  • 0

I have 4 SQL queries that fetch data from the same table and I was wondering whether you can create a view containing multiple queries. For instance, one of these queries looks something like:

SELECT Count(COLUMN1) FROM TABLE1 WHERE COLUMN3 > '01-Oct-12' AND COLUMN3< '01-Nov-12' 

whereas another looks like:

SELECT Count(COLUMN2) FROM TABLE1 WHERE COLUMN3 > '01-Oct-12' AND COLUMN3 < '01-Nov-12' 

Thanks,

I.

  • 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-13T17:04:27+00:00Added an answer on June 13, 2026 at 5:04 pm

    The simplest implementation would be:

    create or replace view v23 as 
         select count(column1) as col1_count
                , count(column2) as col2_count
         from TABLE1
          WHERE COLUMN3 > '01-Oct-12' AND COLUMN3 < '01-Nov-12' 
    

    But if not all your queries use the same criteria you could use scalar sub-queries:

    create or replace view v23 as 
      select 
         (select count(column1) from TABLE1 
            WHERE COLUMN3 > '01-Oct-12' AND COLUMN3 < '01-Nov-12' ) as col1_count 
         , (select count(column2) from TABLE2 
            WHERE COLUMN3 > '01-Oct-12' AND COLUMN3 < '01-Nov-12' ) as col2_count
      from dual   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an SSIS package that queries data from a view using an SQL
I currently have SQL queries developed that fetch me the required data from my
I have compared two queries which fetch some fairly large data from a database
I have several sql queries that I simply want to fire at the database.
I have six SQL queries that I script though R that each take a
I have 3 similar SQL queries that each will bring back 1 record with
I have a couple of LINQ to SQL queries that I feel take a
I have a LINQ to SQL DataContext that queries four different tables. But I
I have several Oracle queries that perform well when run through SQL*PLUS. However when
I have functions in place that will convert the results of sql queries into

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.