Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Is it possible to streamline this query?

Posted on 2004-10-27
6
Medium Priority
?
187 Views
Last Modified: 2013-12-24
Hi,

I have this awful query that I would like to streamline, and add a where clause.
Any ideas?

SELECT *
FROM
table1
Where (firstout Between #MonthStart# and #MonthEnd#)
UNION all

SELECT *
FROM
table2
Where (firstout Between #MonthStart# and #MonthEnd#)
UNION ALL

SELECT *
FROM
table3
Where (firstout Between #MonthStart# and #MonthEnd#)

order by pk
0
Comment
Question by:g118481
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 12423243
well in order to answer this question you will have to tell us what is included in the * in each table.... and how the tables are related.

It would also help to know what kind of data you are pulling.
0
 
LVL 17

Accepted Solution

by:
Tacobell777 earned 200 total points
ID: 12426749
I'm not sure how you can streamline this query even more?
You already have a where clause for each query in the union.. What more do you want?
0
 
LVL 1

Author Comment

by:g118481
ID: 12463360
The tables are not really related, but they do have the same field names.  The data is simple calendar data.
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 200 total points
ID: 12464249
Then I don't think you can do any more if they are not related.

You will be forced to have a union per table if there is no other relation between the tables.
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 12466271
exactly..
0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question