SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 List as at date
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ayyoob1234
Starting Member

3 Posts

Posted - 06/11/2013 :  11:06:57  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

Pakistan
1050 Posts

Posted - 06/11/2013 :  11:33:22  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2170 Posts

Posted - 06/12/2013 :  00:37:35  Show Profile  Reply with Quote
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

India
52249 Posts

Posted - 06/12/2013 :  00:59:53  Show Profile  Reply with Quote

select * 
from table
where start_date = @date
and end_date < @date + 1


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

India
52249 Posts

Posted - 06/12/2013 :  01:01:12  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.38 seconds. Powered By: Snitz Forums 2000