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

  • Home
  • SEARCH
  • 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 3595848
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:54:23+00:00 2026-05-18T19:54:23+00:00

The following very simple query select distinct guid, browser_agent from tblMyGlossary where browser_agent is

  • 0

The following very simple query

select distinct guid, browser_agent
from tblMyGlossary
where browser_agent is not null

provides the following results:

guid         browser_agent
367DE2B8-88A5-4DA9-ACBB-C0864493DC1F Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
5DCB918E-DA56-4545-A4E3-D09B1B803422 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
998B8F37-2C9A-49EB-AA0B-CF88C4CC7BDF Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
A0DD3BCB-E8A9-4434-A869-C343FB21F993 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

Ii want to be able to count the number of unique browser_agent strings, so I am performing the following query:

select browser_agent, count(browser_agent) as 'count'
from
(
 select distinct guid, browser_agent
 from tblMyGlossary
 where browser_agent is not null
)
group by browser_agent
order by 'count' desc;

Problem is SQL 2005 is complaining:

Msg 156, Level 15, State 1, Line 8
Incorrect syntax near the keyword ‘group’.

Can anyone shed any light on how to resolve this please? I’ve run out of ideas.

Many thanks,

Mark

  • 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-18T19:54:24+00:00Added an answer on May 18, 2026 at 7:54 pm

    You need to alias your derived table.

    select browser_agent, count(browser_agent) as 'count'
    from
    (
        select distinct guid, browser_agent
        from tblMyGlossary
        where browser_agent is not null
    ) a
    group by browser_agent
    order by 'count' desc;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following very simple query select distinct guid, browser_agent from tblMyGlossary where browser_agent is
Doing a simple query I'm finding two very different results, and I'm not sure
I have a very simple SQL Query which is getting results in the following
The following simple query takes a very long time (several minutes) to execute. I
I have the following very simple code snippet which is loaded from a separate
I have the following PHP code doing a very simple select into a table.
Using the following query: SELECT title, nid, created FROM node WHERE uid = $account->uid
I've got the following query: SELECT name, GROUP_CONCAT(job SEPARATOR ','), count(*) FROM users GROUP
I have a very simple query (three where conditions; two equals, one between) from
I'm trying to run a query on a very simple table but I'm not

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.