| Author |
Topic  |
|
|
tuka
Starting Member
26 Posts |
Posted - 06/14/2006 : 09:00:21
|
I am trying to get a recordset that gives me along with the id and count, the name (from another table) of a tradelead. Each time I reference a column from the other table, it breaks... I think I understand why but I am at a loss to figure out a solution.. any sugestions ?
THIS WORKS: SELECT COUNT(tb_industry.id_industry) AS tlcount, tb_industry.id_industry FROM tb_tradelead INNER JOIN tb_industry ON tb_tradelead.id_industry=tb_industry.id_industry GROUP BY tb_industry.id_industry
BIT THIS FAILS.... SELECT COUNT(tb_industry.id_industry) AS tlcount, tb_industry.id_industry, tb_industry.name FROM tb_tradelead INNER JOIN tb_industry ON tb_tradelead.id_industry=tb_industry.id_industry GROUP BY tb_industry.id_industry
Server message Column 'tb_industry.name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
TIA, tuka |
|
|
madhivanan
Premature Yak Congratulator
India
22460 Posts |
Posted - 06/14/2006 : 09:18:53
|
You should include that column in Group by Clause
SELECT COUNT(tb_industry.id_industry) AS tlcount, tb_industry.id_industry, tb_industry.name FROM tb_tradelead INNER JOIN tb_industry ON tb_tradelead.id_industry=tb_industry.id_industry GROUP BY tb_industry.id_industry,tb_industry.name
Madhivanan
Failing to plan is Planning to fail |
 |
|
|
tuka
Starting Member
26 Posts |
Posted - 06/14/2006 : 09:33:03
|
| Thanks, that did it ! |
 |
|
|
madhivanan
Premature Yak Congratulator
India
22460 Posts |
|
| |
Topic  |
|