transparent
Programmer
Hello!
I have two tables in a database.
jobtypes -> a single column table which is a list of job types.
ie
'''''''''
'Jobtype'
'''''''''
' type1 '
' type2 '
' type3 '
'''''''''
CV -> a two column table (cv_id and jobtype)
ie
'''''''''''''''''''
' cv_id ' jobtype '
'''''''''''''''''''
' 1 ' type2 '
' 2 ' type2 '
' 3 ' type1 '
' 4 ' type2 '
'''''''''''''''''''
I want to create a statistics table showing the number of cv items per job type.
So I wrote the following SQL:
strSQL = "select jobtypes.jobtype, count(CV.jobtype) as count from jobtypes,cv where jobtypes.jobtype=cv.jobtype group by jobtypes.jobtype"
this returns
'''''''''''''''''''
' Jobtype ' count '
'''''''''''''''''''
' type2 ' 3 '
' type1 ' 1 '
'''''''''''''''''''
however I want:
'''''''''''''''''''
' Jobtype ' count '
'''''''''''''''''''
' type2 ' 3 '
' type1 ' 1 '
' type3 ' 0 '
'''''''''''''''''''
How do I do this?
PS I'm using a MYSQL database.
Cheers
I have two tables in a database.
jobtypes -> a single column table which is a list of job types.
ie
'''''''''
'Jobtype'
'''''''''
' type1 '
' type2 '
' type3 '
'''''''''
CV -> a two column table (cv_id and jobtype)
ie
'''''''''''''''''''
' cv_id ' jobtype '
'''''''''''''''''''
' 1 ' type2 '
' 2 ' type2 '
' 3 ' type1 '
' 4 ' type2 '
'''''''''''''''''''
I want to create a statistics table showing the number of cv items per job type.
So I wrote the following SQL:
strSQL = "select jobtypes.jobtype, count(CV.jobtype) as count from jobtypes,cv where jobtypes.jobtype=cv.jobtype group by jobtypes.jobtype"
this returns
'''''''''''''''''''
' Jobtype ' count '
'''''''''''''''''''
' type2 ' 3 '
' type1 ' 1 '
'''''''''''''''''''
however I want:
'''''''''''''''''''
' Jobtype ' count '
'''''''''''''''''''
' type2 ' 3 '
' type1 ' 1 '
' type3 ' 0 '
'''''''''''''''''''
How do I do this?
PS I'm using a MYSQL database.
Cheers