Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
First and last based on same SQL
Message
From
09/10/2014 22:23:13
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01609079
Message ID:
01609091
Views:
53
>Michel, I think it's a bit unclear what the query is trying to accomplish.

Yes, this might not have been the best example to demonstrate it. Basically, there is a master table and it has one or several child records for each record. If we take the scenario that one master record has 5 child records, where each of them contains a textual field, the goal is to collect the first textual field value based on an order on AddDate, as well as the last value.

So, basically, if the 5 records are like this:

AddDate Name
05/05/2014 Michel Fournier
06/05/2014 Michel Fournier
15/06/2014 James Bond
01/07/2014 James Bond
10/10/2014 King Kong

I need to have Michel Fournier as the first one and King Kong as the last one.

So, the goal is to see if I can extract those two values in one SQL or using two is pretty much what is needed.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform