Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rekhtar
Starting Member
4 Posts |
Posted - 2008-12-24 : 07:11:16
|
Hi bro.Actually I am still beginner in SQL, so I need to know what's wrong in this statement:SELECT Contacts.Company, Telephones.BusinessPhone, Telephones.HomePhone, Telephones.MobilePhone, Telephones.FaxNumber, Contacts.CName, Telephones.Mail, Contacts.JobTitle, Contacts.Street, Contacts.City, Contacts.Country, Contacts.WebPage, Contacts.Notes, Cats.CatNameFROM Cats INNER JOIN (Contacts INNER JOIN Telephones ON Contacts.CID = Telephones.CID) ON Cats.CatID = Contacts.CatIDGROUP BY Contacts.CNameI have 2 tables (Contacts and telephones)one contact has many telephonesI need to view all telephone numbers related to Contact, group by Contact name (CName column).Thanks GuysGod loves the person who gives his information to the mankind |
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2008-12-24 : 07:14:50
|
try like thisSELECT ct.Company, t.BusinessPhone, t.HomePhone, t.MobilePhone, t.FaxNumber, ct.CName, t.Mail, ct.JobTitle, c.Street, ct.City, ct.Country, ct.WebPage, ct.Notes, c.CatNameFROM Cats c INNER JOIN Contacts ct ON c.CatID = ct.CatIDINNER JOIN Telephones t ON ct.CID = t.CID GROUP BY ct.CName |
|
|
rekhtar
Starting Member
4 Posts |
Posted - 2008-12-24 : 10:23:10
|
Thanks for helping but it still not working, there is syntax error(missing operator)God loves the person who gives his information to the mankind |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-12-24 : 10:35:47
|
Hi,Please post your complete query which u tried to execute and error message which you got exactly...so that we may help. |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-24 : 10:57:55
|
quote: Originally posted by rekhtar Hi bro.Actually I am still beginner in SQL, so I need to know what's wrong in this statement:SELECT Contacts.Company, Telephones.BusinessPhone, Telephones.HomePhone, Telephones.MobilePhone, Telephones.FaxNumber, Contacts.CName, Telephones.Mail, Contacts.JobTitle, Contacts.Street, Contacts.City, Contacts.Country, Contacts.WebPage, Contacts.Notes, Cats.CatNameFROM Cats INNER JOIN (Contacts INNER JOIN Telephones ON Contacts.CID = Telephones.CID) ON Cats.CatID = Contacts.CatIDGROUP BY Contacts.CNameI have 2 tables (Contacts and telephones)one contact has many telephonesI need to view all telephone numbers related to Contact, group by Contact name (CName column).Thanks GuysGod loves the person who gives his information to the mankind
If you only want to group by Ct.Cname,then you have to apply aggregate fundtion(Like Min,Max,Sum) for others. |
|
|
rekhtar
Starting Member
4 Posts |
Posted - 2008-12-25 : 12:26:53
|
quote: Originally posted by sodeep
quote: Originally posted by rekhtar Hi bro.Actually I am still beginner in SQL, so I need to know what's wrong in this statement:SELECT Contacts.Company, Telephones.BusinessPhone, Telephones.HomePhone, Telephones.MobilePhone, Telephones.FaxNumber, Contacts.CName, Telephones.Mail, Contacts.JobTitle, Contacts.Street, Contacts.City, Contacts.Country, Contacts.WebPage, Contacts.Notes, Cats.CatNameFROM Cats INNER JOIN (Contacts INNER JOIN Telephones ON Contacts.CID = Telephones.CID) ON Cats.CatID = Contacts.CatIDGROUP BY Contacts.CNameI have 2 tables (Contacts and telephones)one contact has many telephonesI need to view all telephone numbers related to Contact, group by Contact name (CName column).Thanks GuysGod loves the person who gives his information to the mankind
If you only want to group by Ct.Cname,then you have to apply aggregate fundtion(Like Min,Max,Sum) for others.
Actually there is no column must have aggregate function, the really problem is If contact person has 2 mobiles, the query table will display each mobile with the same contact in seperate rowI want to display just names and display (+) next to contact name, and when I want to display his mobiles I press on (+) to show me his mobilesGod loves the person who gives his information to the mankind |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-25 : 13:35:02
|
Looks like you are looking for Interactive Drilldown option. Look for Reporting Services. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-27 : 12:02:12
|
quote: Originally posted by rekhtar
quote: Originally posted by sodeep
quote: Originally posted by rekhtar Hi bro.Actually I am still beginner in SQL, so I need to know what's wrong in this statement:SELECT Contacts.Company, Telephones.BusinessPhone, Telephones.HomePhone, Telephones.MobilePhone, Telephones.FaxNumber, Contacts.CName, Telephones.Mail, Contacts.JobTitle, Contacts.Street, Contacts.City, Contacts.Country, Contacts.WebPage, Contacts.Notes, Cats.CatNameFROM Cats INNER JOIN (Contacts INNER JOIN Telephones ON Contacts.CID = Telephones.CID) ON Cats.CatID = Contacts.CatIDGROUP BY Contacts.CNameI have 2 tables (Contacts and telephones)one contact has many telephonesI need to view all telephone numbers related to Contact, group by Contact name (CName column).Thanks GuysGod loves the person who gives his information to the mankind
If you only want to group by Ct.Cname,then you have to apply aggregate fundtion(Like Min,Max,Sum) for others.
Actually there is no column must have aggregate function, the really problem is If contact person has 2 mobiles, the query table will display each mobile with the same contact in seperate rowI want to display just names and display (+) next to contact name, and when I want to display his mobiles I press on (+) to show me his mobilesGod loves the person who gives his information to the mankind
whats the front end application you're using? |
|
|
rekhtar
Starting Member
4 Posts |
Posted - 2008-12-27 : 14:50:57
|
It's VB.NET 2005God loves the person who gives his information to the mankind |
|
|
|
|
|
|
|