Click to See Complete Forum and Search --> : sql statement error


nebchill26
06-06-2008, 04:33 AM
can i use the Count(*) function when i join 2 tables?

here's my sample code:

SELECT
tblServiceRecRequests.CtrNum,
tblServiceRecRequests.Pc_Name,
tblServiceRecRequests.Problem,
tblServiceRecRequests.ProblemType,
tblServiceRecRequests.Staff,
tblServiceRecRequests.ActionTaken,
tblServiceRecRequests.ServiceStat,

tblServiceRecords.DateRequest,
tblServiceRecords.RequestedBy,
tblServiceRecords.Department,
tblServiceRecords.Location,
tblServiceRecords.DateNeeded

FROM tblServiceRecords, tblServiceRecRequests
WHERE tblServiceRecords.CtrNum = tblServiceRecRequests.CtrNum
AND tblServiceRecords.CtrNum = '100000005'

chazzy
06-06-2008, 05:46 PM
count() works on any select statement.

sridhar_423
06-06-2008, 06:08 PM
if u want to select columns as well with count(), then the columns need to be part of your group by expression