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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Help with query

Author  Topic 

Mondeo
Constraint Violating Yak Guru

287 Posts

Posted - 2010-08-03 : 06:49:58
What is correct syntax for this.

SELECT * FROM tblGenusFranchiseDetails, COUNT (*) FROM vwApprovedUsers WHERE vwApprovedUsers.companyId = tblGenusFranchiseDetails.id)

Thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-08-03 : 07:21:09
Please give us table structure, sample data and wanted output.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-08-03 : 08:48:47
[code]SELECT gfd.*,
au.t
FROM tblGenusFranchiseDetails AS gfd
INNER JOIN (
SELECT companyId,
COUNT(*) AS t
FROM vwApprovedUsers
GROUP BY companyId
) AS au ON au.companyId = gfd.id[/code]


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -