Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 28th, 2011, 10:03 AM
L1NK-KUN L1NK-KUN is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Location: Rotterdam
Posts: 2 L1NK-KUN User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 41 sec
Reputation Power: 0
INNER JOIN subquery SELECT

Hi guys! I am trying to select some data from a table in an Access 2010 database. The thing was: I wanted to display the latest "Configuration" release of each System (adapter). Well, using the SQL code below it seems to work perfectly, but I am having trouble filtering out the "QaEnv", too.

This is what is displayed before the query:

ID | QaEnv | System | Type | Configuration | ActiveDate
1 | Delta (UAT2) EAI-V3 | MOMS Adapter | Adapter | 1.0 | 30-06-2011
2 | Delta (UAT2) EAI-V3 | GSG Adapter | Adapter | 1.1 | 30-06-2011
3 | Yankee (UAT1) ACC-V01 | MOMS Adapter | Adapter | 2.4 | 30-06-2011
4 | Delta (UAT2) EAI-V3 | GSG Adapter | Adapter | 1.0 | 20-06-2011
5 | Delta (UAT2) EAI-V3 | KIWI2 Adapter | Adapter | 1.7 | 30-06-2011
6 | Delta (UAT2) EAI-V3 | KIWI2 Adapter | Adapter | 1.5 | 20-06-2011

This is what is displayed after the query:

ID | QaEnv | System | Type | Configuration | ActiveDate
1 | Delta (UAT2) EAI-V3 | MOMS Adapter | Adapter | 1.0 | 30-06-2011
2 | Delta (UAT2) EAI-V3 | GSG Adapter | Adapter | 1.1 | 30-06-2011
3 | Yankee (UAT1) ACC-V01 | MOMS Adapter | Adapter | 2.4 | 30-06-2011
5 | Delta (UAT2) EAI-V3 | KIWI2 Adapter | Adapter | 1.7 | 30-06-2011

But I want to display this:

ID | QaEnv | System | Type | Configuration | ActiveDate
1 | Delta (UAT2) EAI-V3 | MOMS Adapter | Adapter | 1.0 | 30-06-2011
2 | Delta (UAT2) EAI-V3 | GSG Adapter | Adapter | 1.1 | 30-06-2011
4 | Delta (UAT2) EAI-V3 | KIWI2 Adapter | Adapter | 1.7 | 30-06-2011

Code:
SELECT t.*
FROM Deployments t
INNER JOIN
(
SELECT System, Max(ActiveDate) as ActDate
FROM Deployments
WHERE QaEnv = "Delta (UAT2) EAI-V3" AND Type = "Adapter" 
AND (([ActiveDate] Between #6/20/2011# And #6/30/2011#)) 
GROUP BY System
) 
x ON t.system = x.system AND t.ActiveDate = x.ActDate;


Can any of you help me out?

Thanks in advance,
Dennis

Reply With Quote
  #2  
Old July 28th, 2011, 02:41 PM
L1NK-KUN L1NK-KUN is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Location: Rotterdam
Posts: 2 L1NK-KUN User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 41 sec
Reputation Power: 0
A friend found the answer :-) it prints the results I am looking for.

Code:
SELECT t.QaEnv, t.System, t.Type, MAX(t.Configuration) as Configuration, MAX(t.ActiveDate) as ActiveDate
FROM Deployments t
WHERE t.QaEnv = "Delta (UAT2) EAI-V3" 
AND t.Type = "Adapter" 
AND (([t.ActiveDate] Between #6/20/2011# AND #6/30/2011#))
GROUP BY t.QaEnv, t.System, t.Type
Comments on this post
MrFujin agrees: +1 for posting the answer

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > INNER JOIN subquery SELECT

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap