Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 4th, 2004, 09:39 AM
asweeney asweeney is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 asweeney User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Select Max(Date) from two different tables

This is what I have so far. It is probably way off track, but you will get an idea of what I'm trying to accomplish.

select Max(DatePosted)
from Table1
where customerID = '70'
union all
select Max(DatePosted)
from Table2
where customerID = '70'


What I really want is the Max(DatePosted) from the result of this query (the latest date between the 2 results). I'm new to Sql, so let me know if you need more info.
Thanks

i'm using sql server 2000 btw

Reply With Quote
  #2  
Old April 27th, 2004, 01:33 AM
TeodoraAdina TeodoraAdina is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 2 TeodoraAdina User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
select max(v.Date_1) from
( select Max(date_1) as Date_1
from Table1
where id = '70'
union all
select Max(date_1)
from Table2
where id = '70' ) as v


I believe this will works

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Select Max(Date) from two different tables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT