Advertisement

07.03.2008 at 12:41PM PDT, ID: 23537974
[x]
Attachment Details

Retreiving last posted message date in MS SQL SELECT statement

Asked by DaveRowland in MS SQL Server, SQL Server 2005

Tags: ms sql

Basically, I am struggling again, so I need some quick speedy replies if possible.  I have cut this down to basics, I am after something simple.

I have a table that returns a list of Enquiries, I basically need the 'postings' table which is a list of changes to that enquiry to show the last entry when I do a 'select' search.

Table sos_enquiries
Enquiry ID, Manager, Date of Enquiry, Customer and hopefully two generated field LastPosted with the Message.

SELECT     EnquiryID, Manager, DateOfEnquiry, Customer
FROM         sos_enquiry

Example data
1002,DR,1/1/2008, "The Customer"
1003,JA,12/12/2007, "Another Customer"

Table sos_postings
PostingID, EnquiryID, PostingDate and Message

SELECT     PostingID, EnquiryID, PostingDate, Message
FROM         sos_posting

Example data
1,1002,2/1/2008 12:32, "The Job is going fine"
2,1002,1/1/2008 10:22, "Just Started the job"

The output should be :-

EnquiryID, Manager, DateOfEnquiry, Customer, LastPosted,LastMessage
1002,DR,1/1/2008,"The Customer",2/1/2008 12:32, "The Job is going fine"



Thank you, I know its simple but spent too much time on it so far.
Start Free Trial
 
Loading Advertisement...
 
[+][-]07.03.2008 at 01:34PM PDT, ID: 21928802

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.03.2008 at 01:37PM PDT, ID: 21928823

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, SQL Server 2005
Tags: ms sql
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.03.2008 at 02:29PM PDT, ID: 21929304

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 02:36PM PDT, ID: 21929388

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 02:47PM PDT, ID: 21929511

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628