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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:08:39+00:00 2026-05-27T12:08:39+00:00

I am trying to create a query that will return results for the number

  • 0

I am trying to create a query that will return results for the number of distinct users who have accessed something by date. Right now I have a query that will display 2 columns, the first being date and the second being user name. It will list all the distinct users who accessed the application on a certain date but they will each have their own distinct row. Here is the query that does that:

SELECT DISTINCT logdate, User AS ReportUser
FROM table          
WHERE appname='abcd1234' AND logdate >=DATE-30

I have tried putting COUNT() around User but it says selected non-aggregate values must be part of the associated group.

Any idea how I can get this query to just show like row for the past 30 days and the count of distinct users?

  • 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-27T12:08:40+00:00Added an answer on May 27, 2026 at 12:08 pm

    This will be the right approach for that.

    SELECT logdate, Count(User) AS ReportUser
    FROM table          
    WHERE appname='abcd1234' AND logdate >=DATE-30
    GROUP BY 1
    

    Never use DINTINCT in Teradata. It always slows down your query performance. Use GROUP BYinstead.

    CORRECTION In Teradata 13 the optimizer is able to determines which version is more efficient, based on statistics. This can be found in the Release Summary for Teradata 13 under “Group By and DISTINCT Performance Equivalence”. – http://www.info.teradata.com/edownload.cfm?itemid=083440012 (PDF)

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

Sidebar

Related Questions

I am trying to create a query in MS SQL 2005 that will return
I'm currently trying create a service that will return results of a OLAP cube
I am trying to create a query that will return a List of Person
I'm trying to create a query that will return all the jobs published by
Im trying to create a function, that will return a mysql query, which i
I am trying to create a report in SSRS2000 that will query an ORACLE
I am trying to create a query in SQL Server that will search for
I'm trying to create a query that will pull the first 10 records of
I'm trying to use LINQ To Objects to create a query that will give
I'm trying to create a simple login system that will have the forms and

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.