help Sql

Results 1 to 3 of 3

Thread: help Sql

  1. #1
    Kelvin Guest

    Default help Sql

    I have a problem for example<BR>select count(*) from student where first_name=&#039kelvin&#039 group by first_name<BR><BR>from first_name column there is kelvin, kelvin, john, peter<BR>and return 2,1,1<BR><BR>then what command is return to the total count numbers which is group by first_name and return the val 3 instead of (2,1,1) 3 rows affect<BR><BR>thx

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default Hoplessly lost

    What do you wnat<BR><BR>if you do this<BR>select count(*) from student group by first_name<BR><BR>then it will give you the # of each item in the table <BR>so kelvin, kelvin, john, peter will give you 2, 1, 1<BR><BR>this on the other hand<BR>select count(*) from student where first_name=&#039kelvin&#039 group by first_name<BR><BR>will only give you the rows where first_name=&#039kelvin&#039 so kelvin, kelvin, john, peter will return 2<BR><BR>where did a 3 come into this. I dont know how you want a 3. <BR><BR>Could you please explain that bit again<BR><BR>

  3. #3
    Kevin Guest

    Default RE: Hoplessly lost

    Thank you... but i want get the total no of last_name excluding any duplicate, actually i use the example for login (I/P) then i can make sure how many unique ppl login today<BR>thank pls help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts