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.
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 datemy table is as follow :a/c id start_Date end_date balancemy code isselect * from tablewhere start_date = 'date'and end_date = 'dateplzz 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-11CheersMIK |
|
|
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 datemy table is as follow :a/c id start_Date end_date balancemy code isselect * from tablewhere start_date = 'date'and end_date = 'dateplzz help
May be you want to list the balances in between the start_date and End_dateCase1: SELECT *FROM TableWHERE start_date >= @date1 AND end_Date <= @date2Case2: Another case is as follows:select * from tablewhere start_date = 'date'OR end_date = 'date--Chandu |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-12 : 00:59:53
|
[code]select * from tablewhere start_date = @dateand end_date < @date + 1[/code]will give you the balances captured as on the passed @date value------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
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 datemy table is as follow :a/c id start_Date end_date balancemy code isselect * from tablewhere start_date = 'date'and end_date = 'dateplzz help
May be you want to list the balances in between the start_date and End_dateCase1: SELECT *FROM TableWHERE start_date >= @date1 AND end_Date <= @date2Case2: Another case is as follows:select * from tablewhere 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 MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|