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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Min Date > another date

Author  Topic 

Highwyre237
Starting Member

2 Posts

Posted - 2008-11-11 : 11:54:23
Hey,

I have a query that I'm trying to figure out. Essentially I have 2 tables with date fields that I need to compare. This is the section I’m having the issue with.

MIN(MAPF.DateFlagged) AS 'FirstFlag',
MIN(APV.DateCreated > 'FirstFlag') AS 'DateLoggedIn'

Obviously the second line is incorrect, but mainly what I need to grab from this is the min APV.DateCreated when the date is larger than the min MAPF.DateFlagged. I am lost. (sorry pretty knew at all of this, and cant find the answer anywhere)

Thanks!

hanbingl
Aged Yak Warrior

652 Posts

Posted - 2008-11-11 : 12:14:17
assume you are joining these two tables.

case when MIN(APV.DateCreated) > MIN(MAPF.DateFlagged) then MIN(APV.DateCreated) else MIN(MAPF.DateFlagged) end as DATELOGGEDIN
Go to Top of Page

Highwyre237
Starting Member

2 Posts

Posted - 2008-11-11 : 12:22:24
Yep, they are joined, this worked perfectly, Thanks! Sorry for coming with such a novice question, should have been able to figure that out.
Go to Top of Page
   

- Advertisement -