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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:20:11+00:00 2026-05-30T07:20:11+00:00

The table structure is as follows: NOTE : The names used are for illustrative

  • 0

The table structure is as follows:

NOTE: The names used are for illustrative purposes only.

Table T1 – col1 INT, col2 CHAR, col3 VARCHAR

Table T2 – col1 INT, col2 VARCHAR col3 CHAR

Table T3 – col1 INT – col1 from Table 2 col2 INT – col2 from Table T col3 INT

SELECT tt1.col2, COUNT(tt1.col1) FROM T1 tt1, T2 tt2, T3 tt3 WHERE tt2.col1 = tt3.col1 AND      
tt3.col2 = tt1.col1 GROUP BY tt1.col1, tt1.col2 HAVING EVERY (tt2.col3 = 'something');

This shows an error that matches the title of the question; However, no error is reported if I remove the HAVING clause.

Is the query syntactically correct?

  • 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-30T07:20:13+00:00Added an answer on May 30, 2026 at 7:20 am
    SELECT tt1.col2, COUNT(tt1.col1) 
    FROM T1 tt1 
    JOIN T3 tt3 ON (tt3.col2 = tt1.col1)
    JOIN T2 tt2 ON (tt2.col1 = tt3.col1)
    WHERE tt2.col3 = 'something'
    GROUP BY tt1.col2;
    

    It doesn’t appear that you need a HAVING clause. You use a HAVING clause when you need to filter results after your GROUP BY has been executed. For example, if you wanted only the records with a count(tt1.col1) greater than 10, you would use a HAVING clause. (HAVING count(tt1.col1) > 10)

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

Sidebar

Related Questions

I have database table whose structure is as follows: id int name varchar(20) dob
My table structure is: TABLE `licenses` ( `id` int(11) NOT NULL auto_increment, `code` varchar(30)
I have the following table structure ZoneID int ZoneName varchar(50) I need to get
I have a table whose structure is as follows: id int userid int status
The schema is as follows: CREATE TABLE [Structure]( [StructureId] [uniqueidentifier] NOT NULL, [SequenceNumber] [int]
hopefully somebody can help The table structure is as follows: tblCompany: compID compName tblOffice:
Table structure- int PrimaryKey DateTime Date int Price What I would like to do
My table structure is as follows: mid | tid | data | 1 |
My table structure is as follows: Person 1-M PesonAddress Person 1-M PesonPhone Person 1-M
I have a table that its structure is as like as follow: `id` int(10)

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.