Fist off I do not know what SQL you are using, but you left me a hint.
I tried a GROUP BY BD.a_id and I got an error saying that BD.id wasn't in an aggregate function or in the group by.
I think you're using MSSQL or TSQL. Then again- I don't see any schema names. Either way I think I see the issue.
You have the correct idea, you are just missing something technical.
You need to put EVERYTHING you select inside of an aggregate function that you have not put inside of the group by clause. I typically use max(); should I actually intend to use max(), I will type MAX() in all uppercase-- as a note to myself that it is important. I do that to distinguish syntax from semantics.
Be mindful that it WILL select max(); using min() or avg() [etc] may produce a different result; it may also make no difference at all making the whole ordeal of using aggregate functions a syntax pita.
Try this out:
max(BD.id) as id,
max((CONVERT(varchar,A.agent_id)+' '+A.fname+' '+A.lname)) as name,
max(BD.b_id) as b_id,
max(BD.agent_id) as agent_id,
max((CONVERT(varchar,BDD.billing)+' '+ BDD.description)) as billing,
max(BD.inactive) as inactive
FROM Univlicval_billing_digits as BD
INNER JOIN Univlicval_agents as A
ON BD.a_id = A.id
INNER JOIN Univlicval_bd_desc BDD
ON BD.b_id = BDD.id
(BD.b_id = @b_id)
GROUP BY BD.a_id
I share your disappointment with TSQL's clunky aggregate function syntax. I believe it is in part due to TSQL being statically typed.