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 3333714
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:49:36+00:00 2026-05-17T23:49:36+00:00

My SQL seems to be letting me down this morning. I have a table

  • 0

My SQL seems to be letting me down this morning. I have a table with the columns

Id, Guid,AttributeId,AttributeValue,CreationDate,Status

This stores data from a qustonnaire which has around 15 pages to it. Each time you move on to the next question (next page) in the questionnaire the entire questionnaire is persisted to the table i.e after completing the 1st question, that questions data is stored in the table, after completing the 2nd question, the 1st and 2nd question is persisted to the table meaning that know, we have two lots of the 1st qestion and one lot of the second question saved in the table.

I need to write a query that will return the latest lot of saved data for a given questionnaire (and all questionnaires). i.e. if the user got to question 13 i would want only that set of data returned.

  • 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-17T23:49:37+00:00Added an answer on May 17, 2026 at 11:49 pm

    Something like…

    SELECT Q.*
    FROM Questionnaire Q
    INNER JOIN (
      SELECT TOP 1 Guid, CreationDate
      FROM Questionnaire
      ORDER BY CreationDate DESC
    ) Q2
    ON Q2.Guid = Q.Guid AND Q2.CreationDate = Q.CreationDate
    

    …ought to do it. The join to Guid is possibly redundant – and you’ll presumably need a WHERE somewhere to ensure you get the questionnaire for the particular user / session.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing some performance testing and have found that SQL seems to be
This evaluation in sql doesn't seems to work properly for some reason but i
This seems like it should be very easy...anyway, it is in MS SQL Server
On a SQL Server 2000 system, I have a templog.ldf file that seems to
This SQL seems complex, is there an easier way to get FirstName, LastName when
Microsoft SQL Server seems to check column name validity, but not table name validity
I have a SQL query that seems to be producing correct results but according
I'm pretty familiar with grails however my sql logging seems to always be on
It seems that SQL Server has a fair amount of XML support. Mostly I've
It seems that SQL Server does not accept numbers formatted using any particular locale.

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.