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
 List as at date

Author  Topic 

ayyoob1234
Starting Member

3 Posts

Posted - 2013-06-11 : 11:06:57
hi..

i am trying to get a list of balances as at date

my table is as follow :
a/c id start_Date end_date balance

my code is

select *
from table
where start_date = 'date'
and end_date = 'date

plzz help

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2013-06-11 : 11:33:22
Whats the problem with it? if you're looking for records on a certain start and end dates teh query will give you those records.. you will need to provide required date values e.g.
select * from table where start_date = '2013-06-11' and end_date='2013-06-11' --will give you the records where the start and end date are 2013-06-11

Cheers
MIK
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-06-12 : 00:37:35
quote:
Originally posted by ayyoob1234

hi..

i am trying to get a list of balances as at date

my table is as follow :
a/c id start_Date end_date balance

my code is

select *
from table
where start_date = 'date'
and end_date = 'date

plzz help


May be you want to list the balances in between the start_date and End_date

Case1:
SELECT *
FROM Table
WHERE start_date >= @date1 AND end_Date <= @date2

Case2: Another case is as follows:
select *
from table
where start_date = 'date'
OR end_date = 'date


--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-12 : 00:59:53
[code]
select *
from table
where start_date = @date
and end_date < @date + 1
[/code]

will give you the balances captured as on the passed @date value

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-12 : 01:01:12
quote:
Originally posted by bandi

quote:
Originally posted by ayyoob1234

hi..

i am trying to get a list of balances as at date

my table is as follow :
a/c id start_Date end_date balance

my code is

select *
from table
where start_date = 'date'
and end_date = 'date

plzz help


May be you want to list the balances in between the start_date and End_date

Case1:
SELECT *
FROM Table
WHERE start_date >= @date1 AND end_Date <= @date2

Case2: Another case is as follows:
select *
from table
where start_date = 'date'
OR end_date = 'date


--
Chandu


will cause all records in @date2 after the start of day to be ignored if fields are of type datetime and has a time part

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -