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 |
|
Stan1978
Starting Member
31 Posts |
Posted - 2011-10-06 : 08:52:39
|
| I want to compare two dates from separate tables. Currently I user the query below;select dbo.Trans.AccountID,(SELECT dbo.Property.[Value] FROM dbo.Property WHERE dbo.Property.AccountID = dbo.Trans.AccountID and dbo.Property.Property = 'Creation') AS Registration,max(CASE WHEN dbo.Trans.TransType = 'Deposit' AND DeltaCash < 0 THEN left(Transid,8) ELSE NULL END) AS LastDepDayfrom dbo.Transgroup by dbo.Trans.AccountIDWhich gives the following results;AccountID-------Registration-------------------------LastDepDay123-------------2011-07-16 01:00:00;10.159.11.2------20110801How do I convert the dates into a format that I can compare? I hope this makes sense. Many thanks. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-06 : 09:00:09
|
| what are datatypes of Transid and dbo.Property.[Value] ?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Stan1978
Starting Member
31 Posts |
Posted - 2011-10-06 : 11:51:34
|
| TransID is a bigint, property value is in this format 2011-07-16 01:00:00;10.159.11.2 - not sure what is is called.How would I find that out?Thank you. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-06 : 12:11:53
|
| check the table definitionsp_help ' dbo.Property'sp_help 'dbo.Trans'------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|