|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
sql count and group by?
i have a view with select statement, collection of column from two diff table on two diff database using same login. l want to be able to count total rows and group by each name
e.g let's say this is my table from view table column ......................................................... name , address, email, telephone, comment, id ......................................................... frank, ist stree, email, 000-00, another test,2 frank, ist street,email, 111-00, here anothe , 2 mark, 2nd street, email,00-00, comment here, 4 ......................................................... i want count result like frank, ist stree, email, 000-00, another test frank, ist street,email, 111-00, here anothe toltal:2 ......................................................... mark, 2nd street, email,00-00, comment here total:1 i have ques like this. CREATE view test1 as SELECT Count(*) AS Total, name,address,comment, id FROM dbo.table1 database2.dbo.table2 WHERE (name = id) group by name,address,comment, id ...................................................... but i cant get that result im looking for. i want to be able to group by name and have total record for each person. any ideas is appreciated |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > sql count and group by? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|