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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:04:08+00:00 2026-06-12T09:04:08+00:00

I got a problem with sql. i dunno why access and sql server keep

  • 0

I got a problem with sql. i dunno why access and sql server keep show me the error.
I use phpmyadmin, but no issue.

I have 1 table. My table name is t_data

ID  MasterCode  DetailCode  Description  Item  Status
1       1           1.1      Resources   Meat     1
2       1           1.1      Resources   Meat     1
3       1           1.1      Resources   Meat     1
4       1           1.1      Resources   Meat     1
5       3           3.1       Utility    oil      1
6       2           2.1      Transport   BBM      1

I want to query that table and want the result looks like:

MasterCode  Description
    1       Resources
    2       Utility
    3       Transport

And here is my sql syntax

"select MasterCode, Description from t_data group by Description order by MasterCode"

Usually i just use that sql syntax, and i can get what i want. But now i can’t.

you tried to execute a query which does not include the specified expression as an aggregate function.

I got that error if i’m using access and sql server. If i’m using phpmyadmin in XAMPP, it working fine. But I don’t want to use phpmyadmin. I want to use access or sql server.

I already search on google about that error. and i change my sql into this.

"select count(*), Description from t_data group by Description "

and"select a.categoryMaster, b.categoryDesc from t_category a inner join t_category b on a.categoryDetail = b.categoryDetail"

not solved my problem, because i want to get the MasterCode too.

any solution? thanks.

  • 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-06-12T09:04:09+00:00Added an answer on June 12, 2026 at 9:04 am

    You can use DISTINCT:

    select distinct MasterCode, Description 
    from t_data
    order by MasterCode;
    

    See SQL Fiddle with Demo

    Or you might be able to use an aggregate function like MAX():

    select max(MasterCode) MasterCode, Description 
    from t_data
    group by Description
    order by MasterCode;
    

    See SQL Fiddle with Demo

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

Sidebar

Related Questions

I've got a problem with my SQL. I have a table (named Regions) looking
i have got a problem with my SQL Statement: Table structure: CREATE TABLE tags
I'm getting crazy with this problem: I have got some Oracle SQL-Reports to redesign
I got a stupid problem with SQL that I can't fix. ALTER TABLE `news`
I've got a problem with multiple deadlocks on SQL server 2005. This one is
I got one problem from comparing database schema as i use Red gate SQL
I got a little problem. I'm using Full outer Join in Sql server -
I've got a problem with fresh install of SQL Server. ConnectinString: Data Source=(local);Initial Catalog=SGGW.USS;Integrated
I got this a problem, I need translate this SQL Query to Criteria, but
I've got the following table schema in SQL Server 2005 and I'd like to

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.