Jump to content

Calling SQL experts: count and group by


k2s

Recommended Posts

Oka table lo 

name , site, channel, posts

scrooge, afdb, discussion, 100

scrooge,afdb, visa, 10

scrooge, ttdb, discussion, 100

spartan, afdb, discussion. 200

spartan, afdb, masala, 3000

spartan, ILDB, relationship, 10000

samaja, afdb, masala, 100

loser, afdb, masala, 10000

loser, afdb, discussion, 100

 

undi... i want output as in how many distinct channels scrooge participated(afdb and ttdb) 

 

name , site

scrooge, 2

spartan, 2

samaja, 1

loser, 1

 

emi cheyyali

Link to comment
Share on other sites

38 minutes ago, k2s said:

Oka table lo 

name , site, channel, posts

scrooge, afdb, discussion, 100

scrooge,afdb, visa, 10

scrooge, ttdb, discussion, 100

spartan, afdb, discussion. 200

spartan, afdb, masala, 3000

spartan, ILDB, relationship, 10000

samaja, afdb, masala, 100

loser, afdb, masala, 10000

loser, afdb, discussion, 100

 

undi... i want output as in how many distinct channels scrooge participated(afdb and ttdb) 

 

name , site

scrooge, 2

spartan, 2

samaja, 1

loser, 1

 

emi cheyyali

thatha nee explanation wrong.

 

afdb,ttdb are not channels they are sites.

 

Ika Answer antava paina @Prince_Fan vuncle ichadu choodu... valla Christian roommate confirm chesadu (vuncle eeroje talantu posadanta) photo-thumb-55678.jpg

 

Link to comment
Share on other sites

37 minutes ago, Prince_Fan said:

no.of distinct channels aithe idi anukulu ...

select name, count(distinct channel)

from table

group by name

 

thanks lolbob... adey chesa... 

naaku number of distinct channels for distinct names kavali.... so i used 

select distinct name, count(distinct channel) 

ani use chesa.. 

Link to comment
Share on other sites

13 minutes ago, Bhai said:

thatha nee explanation wrong.

 

afdb,ttdb are not channels they are sites.

 

Ika Answer antava paina @Prince_Fan vuncle ichadu choodu... valla Christian roommate confirm chesadu (vuncle eeroje talantu posadanta) photo-thumb-55678.jpg

 

lolbob ki ardam ayindi.. answer seppadu. madyalo nuvvu thappulu vethaku..... naaku query execute ayindi with result 20 mins back ee 

Link to comment
Share on other sites

2 minutes ago, mysterious said:

the above ans is according to your question and if you are looking for total count for scoorge

i want for all users man.. like this

name , site

scrooge, 2

spartan, 2

samaja, 1

loser, 1

 

Image result for brahmi gifs

Link to comment
Share on other sites

  1. select name, site, count( *) from k2s group by name, site;
     
  2. samaja    afdb    1
    loser    afdb    2
    scrooge    ttdb    1
    spartan    afdb    2
    scrooge    afdb    2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...