Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query help needed! :)

Author  Topic 

lwarunek
Starting Member

22 Posts

Posted - 2007-12-04 : 05:25:01
Hi all!

I have been working on the query that is supposed to pull out data to do the following thing:

there are orders that are both complete and not complete yet in the same table.

there is startDate and endDate for complete ones and forecastStartDate and forecastEndDate for not complete one.

I need to pull out data from the same table but using two different conditions in order to create monthly income.

Is there any easy way of doing it? Or do i need to separate my main table. However the last would result in me changing the whole application because of one stupid statement!


Thanks for help.
Lucas

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-12-04 : 06:03:32
first select
union all
second select

or post relevant table definition, some sample data and results based on the sample data to get a better anwser.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-12-04 : 06:55:05
Being slightly more vague would also help.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -