none
how to using count in query RRS feed

  • Question

  • i need make query when i run it he need insert year just year not full date

    After writing the year, the query searches all months of the year that you type
    Then he compares all the months and brings the month that contains the largest number of people

    Download DataBase:

    https://ufile.io/6zfke

    Friday, November 3, 2017 2:22 PM

Answers

  • You may download OP's database and have a try. The field names of OP's table are TypeName, TypePrice, TypeDate in my machine.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 8, 2017 1:48 AM
    Moderator

All replies

  • Hi,

    Is this related to your other question? What have you tried so far?

    Friday, November 3, 2017 3:23 PM
  • Hi,

    Is this related to your other question? What have you tried so far?

    no no bro this other question old question is solved i make your replay is best answer

    i wait your solution for this topic

    Friday, November 3, 2017 3:29 PM
  • Post the SQL of a SELECT query that has all the required fields.

    State the datatype of those fields.


    Build a little, test a little

    Friday, November 3, 2017 6:42 PM
  • Post the SQL of a SELECT query that has all the required fields.

    State the datatype of those fields.


    Build a little, test a little


    i don't understand you what you mean
    Friday, November 3, 2017 6:50 PM
  • I assume that you ARE working in Access the Microsoft relational database program.

    First in Design View create a SELECT query that has all the required fields.

    Then click on the VIEW pull down and click on SQL View.   Highlight all, copy, and paste in a post.

    Include in your post the datatype of all the fields.


    Build a little, test a little

    Friday, November 3, 2017 8:48 PM
  • Hello,

    Please use

    SELECT tb.ID, tb.TypeName, tb.TypePrice, tb.TypeDate
    FROM (SELECT help.ID, help.TypeName, help.TypePrice, help.TypeDate, Year([TypeDate]) AS Expr1, *
    FROM help WHERE (((Year([TypeDate]))=YearInput))) as tb Where Month(tb.TypeDate)=(SELECT TOP 1 MonthDate from(
    SELECT Month(tb.[TypeDate]) as MonthDate, Count(*) as CountOf
    FROM (SELECT help.ID, help.TypeName, help.TypePrice, help.TypeDate, Year([TypeDate]) AS Expr1, *
    FROM help WHERE (((Year([TypeDate]))=YearInput))) as tb Group by Month(tb.[TypeDate])) ORDER BY CountOf Desc)

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 6, 2017 7:23 AM
    Moderator
  • Your query SQL makes no sense to me.

    It looks like you have a table named 'tb' and 'help' with field names of 

    TypeName, TypePrice, TypeDate, and YearInput.


    Build a little, test a little

    Tuesday, November 7, 2017 5:51 PM
  • You may download OP's database and have a try. The field names of OP's table are TypeName, TypePrice, TypeDate in my machine.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 8, 2017 1:48 AM
    Moderator