| Author |
Topic  |
|
|
rekhtar
Starting Member
Egypt
4 Posts |
Posted - 12/24/2008 : 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.CatName FROM Cats INNER JOIN (Contacts INNER JOIN Telephones ON Contacts.CID = Telephones.CID) ON Cats.CatID = Contacts.CatID GROUP BY Contacts.CName
I have 2 tables (Contacts and telephones) one contact has many telephones I need to view all telephone numbers related to Contact, group by Contact name (CName column).
Thanks Guys
God loves the person who gives his information to the mankind |
|
|
bklr
Flowing Fount of Yak Knowledge
India
1693 Posts |
Posted - 12/24/2008 : 07:14:50
|
try like this SELECT 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.CatName FROM Cats c INNER JOIN Contacts ct ON c.CatID = ct.CatID INNER JOIN Telephones t ON ct.CID = t.CID GROUP BY ct.CName |
Edited by - bklr on 12/24/2008 07:15:36 |
 |
|
|
rekhtar
Starting Member
Egypt
4 Posts |
Posted - 12/24/2008 : 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 - 12/24/2008 : 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
Flowing Fount of Yak Knowledge
USA
7173 Posts |
Posted - 12/24/2008 : 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.CatName FROM Cats INNER JOIN (Contacts INNER JOIN Telephones ON Contacts.CID = Telephones.CID) ON Cats.CatID = Contacts.CatID GROUP BY Contacts.CName
I have 2 tables (Contacts and telephones) one contact has many telephones I need to view all telephone numbers related to Contact, group by Contact name (CName column).
Thanks Guys
God 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
Egypt
4 Posts |
Posted - 12/25/2008 : 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.CatName FROM Cats INNER JOIN (Contacts INNER JOIN Telephones ON Contacts.CID = Telephones.CID) ON Cats.CatID = Contacts.CatID GROUP BY Contacts.CName
I have 2 tables (Contacts and telephones) one contact has many telephones I need to view all telephone numbers related to Contact, group by Contact name (CName column).
Thanks Guys
God 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 row
I 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 mobiles
God loves the person who gives his information to the mankind |
 |
|
|
sodeep
Flowing Fount of Yak Knowledge
USA
7173 Posts |
Posted - 12/25/2008 : 13:35:02
|
| Looks like you are looking for Interactive Drilldown option. Look for Reporting Services. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47173 Posts |
Posted - 12/27/2008 : 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.CatName FROM Cats INNER JOIN (Contacts INNER JOIN Telephones ON Contacts.CID = Telephones.CID) ON Cats.CatID = Contacts.CatID GROUP BY Contacts.CName
I have 2 tables (Contacts and telephones) one contact has many telephones I need to view all telephone numbers related to Contact, group by Contact name (CName column).
Thanks Guys
God 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 row
I 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 mobiles
God loves the person who gives his information to the mankind
whats the front end application you're using? |
 |
|
|
rekhtar
Starting Member
Egypt
4 Posts |
Posted - 12/27/2008 : 14:50:57
|
It's VB.NET 2005
God loves the person who gives his information to the mankind |
 |
|
| |
Topic  |
|
|
|