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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:37:39+00:00 2026-05-26T03:37:39+00:00

I am trying to choose the single row from table Responses that meets a

  • 0

I am trying to choose the single row from table Responses that meets a couple of conditions AND has the most recent date in the update_datetime field. (I actually want ALL the fields from the Responses row, but I’ll settle for just its response_uuid.)

My attempt at this query, below, yields the error “An expression of non-boolean type specified in a context where a condition is expected, near ‘)'”. What on earth am I doing wrong?

select response_uuid, MAX(update_datetime) 
from Responses 
where question_id=2115
and session_uuid in (
  select session_uuid from Sessions
  where client_uuid = '552782A2-4DC6-4715-B278-4C7F5F867975'
)
group by response_uuid
having MAX(update_datetime)

I’ve stared at similar questions all over the interwebs, and I’m just not seeing what the issue is. Thank you for any help!

p.s. This is actually a small part of a much larger query if you’re interested in seeing the whole thing, or if seeing it all would be helpful.

  • 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-26T03:37:40+00:00Added an answer on May 26, 2026 at 3:37 am

    The problem is here:

    having MAX(update_datetime)
    

    This is expecting a boolean expression (something that is logically true or false), like MAX(update_datetime) = <something>. You have no expression it can evaluate as true or false, because you have nothing to compare.

    From the look of your query (unless there’s something I’m not seeing), you can just remove the HAVING completely. The GROUP BY on a MAX aggregate should give you what you want. (I’d suggest you name the resulting column using something like MAX(update_datetime) AS MaxDateTime for clarity.)

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

Sidebar

Related Questions

I'm trying to do some parameter estimation and want to choose parameter estimates that
Trying to find some simple SQL Server PIVOT examples. Most of the examples that
Using MySQL and PHP. I'm trying to select 4 random ads from a table.
I am trying to create an ANI lookup table from 2 separate tables, one
I'm trying to make an algorithm that will find the most efficient ordering for
I'm trying to choose a tool for creating UML diagrams of all flavours. Usability
I'm trying to choose a hash algorithm for comparing about max 20 different text
I'm trying to choose some files to upload in Windows Phone 7 (in the
Having problems with a small awk script, Im trying to choose the newest of
Trying to make a make generic select control that I can dynamically add elements

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.