Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3397994
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:35:45+00:00 2026-05-18T04:35:45+00:00

I have the following SQL SELECT CNumber, MAX(FormSubmitted), Score FROM dbo.vw_MSA WHERE (Score IS

  • 0

I have the following SQL

SELECT     CNumber, MAX(FormSubmitted), Score
FROM         dbo.vw_MSA
WHERE     (Score IS NOT NULL)
GROUP BY CNumber, Score

Results:

CNumber FormSubmitted                   Score
0011509 2010-09-13 10:22:46.763         11
0016239 2010-09-28 13:53:58.557         8*
0016239 2010-10-12 11:52:33.150         12
0018792 2010-11-02 13:17:37.437         3
0051089 2010-10-07 11:38:29.257         13
0051091 2010-10-01 12:01:30.450         0
0067987 2010-09-29 11:06:48.490         7
0079351 2010-09-30 09:49:10.747         34
0833933 2010-09-30 12:54:19.013         6
0848185 2010-10-07 12:08:42.087         6
5010590 2010-11-01 09:54:14.790         6*
5010590 2010-11-16 15:23:50.350         12

I’m sure I should be able to sort this easily but for whatever reason I’m struggling atm. I need Score included in the results but having this in the GROUP BY inevitably returns more than just the record with the latest FormSubmitted date. Can anyone help me out in updating this query so I will get the Score in the results but only those records that are the maximum FormSubmitted date i.e exclude those marked *?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:35:45+00:00Added an answer on May 18, 2026 at 4:35 am
    SELECT     A.CNumber, A.FormSubmitted, A.Score
    FROM         dbo.vw_MSA A
    INNER JOIN 
    (SELECT CNumber, MAX(FormSubmitted) AS MaxSubmitted 
    FROM dbo.vw_MSA
    WHERE     (Score IS NOT NULL)
    GROUP BY CNumber) AS B
    ON A.CNumber = B.CNumber AND A.FormSubmitted = B.MaxSubmitted
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following SQL statementL: select DATE(bla), count(*) from tableA group by DATE(bla) UNION
I have the following SQL: SELECT * FROM [Database].dbo.[TagsPerItem] INNER JOIN [Database].dbo.[Tag] ON [Tag].Id
I have the following SQL query: select AuditStatusId from dbo.ABC_AuditStatus where coalesce(AuditFrequency, 0) <>
I have the following SQL query select s.comments + s.further_comments from dbo.samples s where
I have the following SQL statement: SELECT [id], [name] FROM [dbo.test_db_002] t1 LEFT JOIN
I have the following sql statement: select val, count(*) as tally from sometable group
I have the following SQL statement SELECT [Motor] ,[Time] FROM [logger].[dbo].[motor] WHERE day([Time]) =
I have the following SQL query - SELECT * FROM dbo.LocalContacts WHERE name LIKE
I have the following SQL-statement: SELECT DISTINCT name FROM log WHERE NOT name =
I have the following SQL statement SELECT [CodeHouse] ,[CodeReq] ,[Address] FROM [ShahrdariProject].[dbo].[House] where [CodeReq]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.