Count the data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • haot2307
    New Member
    • Apr 2012
    • 3

    Count the data

    I have a table called program within it are several fields including:

    id_program
    id_student

    how I want to get id_student based on highest id_program volumes of data

    let say row in table:-

    row 1 : id_program : 1, id_student :001,
    row 2 : id_program : 2, id_student :001,
    row 3 : id_program : 3, id_student :002,
    row 4 : id_program : 4, id_student :001,
    row 5 : id_program : 5, id_student :003.


    query that i need is it will result like this :-
    highest program : 001
    Number program : 3
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I have no idea how you went from your sample data to your results.

    Comment

    • haot2307
      New Member
      • Apr 2012
      • 3

      #3
      I want to get the most id_student create programs

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Yes, you've already said that, I don't know what you mean by it.

        Comment

        • roshan ban
          New Member
          • Apr 2012
          • 21

          #5
          You can simply Use
          Select Id_student as highest_program , Count(Id_studen t) as Number_program From Your table name

          Comment

          • deric
            New Member
            • Dec 2007
            • 92

            #6
            This question belongs to SQL. Anyway, use GROUP BY and COUNT together

            Code:
            SELECT COUNT(id_program) AS prog, id_program, id_student FROM YourTable GROUP BY id_student

            Comment

            Working...