Click here to Skip to main content
16,017,502 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Exeperts


I have one table, EntryDate and Amount are the fields of this table.
and I have another table has From Date and End date.

First Table - EntryDate,amount
Second Table - FromDate,ToDate,IsActive

I need to get amount where entrydate from first table not between the second table fromdate and todate.

My sample query is


SQL
select sum(amount) from FirstTable where entrydate is not between (select FromDate,ToDate from SeconTable)



How can i get this query

Please this is my urgent needed

Please send me the queries as soon as possible

Thanks & Regards

Justin Diraviam
Posted
Updated 17-May-12 19:15pm
v2

1 solution

You could try something like
SQL
select sum(amount) 
from FirstTable 
where entrydate is not between (select FromDate from SeconTable)
                       and     (select ToDate from SeconTable)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900