cfdeveloper
Programmer
Hello everybody, I really need someone to help me here. I'm developing a report and stats front-end interface
for a job logging system in ColdFusion and SQL Server 2000. I need your help in writing a sql query. I want to get
the top 5 issues used when logging a job for a customer from the database. All issues are stored in a table called
job_issues and all jobs logged by customers are stored in the job table. The job_issues table has a primary key called
issueUnique which is referenced in the jobs table. I'll give you an example and hopefully it will help you understand what I'm asking here.
Ex data stored in the job_issues table:
CODE
Issue1 Issue2 IssueUnique
Administration Change 26
Administration Move 104
Administration Copy 115
Administration New 53
Administration Delete 54
Advice General 159
Advice Hardware 30
Advice Software 31
Fault Hardware 16
Fault Software 17
Fault Virus 182
Maintenance Equipment 158
Maintenance Scheduled Event 28
Project IT 34
Project Engineering 35
I want to get all issueUnique values where Issue1 is not null and Issue2 is not null. This query should do the job
CODE
SELECT IssueUnique
FROM job_issues
WHERE (Issue1 <> '') AND (Issue1 IS NOT NULL)
AND (Issue2 <> '') AND (Issue2 IS NOT NULL)
ORDER BY IssueUnique
Sample Results:
CallSubjectUnique
6
16
17
19
20
21
22
24
26
28
29
30
31
32
I want to now query the jobs table and return a recordset containing the top 5 (5 most frequent issues used when logging jobs) issues in a date range.
The date value is stored in the logdatetime column in the jobs table. The jobs table has a column to store the issueUnique with the same name. I hope this is making sense.
I would really apprecaite your help on this
Best regards
cfcoder
for a job logging system in ColdFusion and SQL Server 2000. I need your help in writing a sql query. I want to get
the top 5 issues used when logging a job for a customer from the database. All issues are stored in a table called
job_issues and all jobs logged by customers are stored in the job table. The job_issues table has a primary key called
issueUnique which is referenced in the jobs table. I'll give you an example and hopefully it will help you understand what I'm asking here.
Ex data stored in the job_issues table:
CODE
Issue1 Issue2 IssueUnique
Administration Change 26
Administration Move 104
Administration Copy 115
Administration New 53
Administration Delete 54
Advice General 159
Advice Hardware 30
Advice Software 31
Fault Hardware 16
Fault Software 17
Fault Virus 182
Maintenance Equipment 158
Maintenance Scheduled Event 28
Project IT 34
Project Engineering 35
I want to get all issueUnique values where Issue1 is not null and Issue2 is not null. This query should do the job
CODE
SELECT IssueUnique
FROM job_issues
WHERE (Issue1 <> '') AND (Issue1 IS NOT NULL)
AND (Issue2 <> '') AND (Issue2 IS NOT NULL)
ORDER BY IssueUnique
Sample Results:
CallSubjectUnique
6
16
17
19
20
21
22
24
26
28
29
30
31
32
I want to now query the jobs table and return a recordset containing the top 5 (5 most frequent issues used when logging jobs) issues in a date range.
The date value is stored in the logdatetime column in the jobs table. The jobs table has a column to store the issueUnique with the same name. I hope this is making sense.
I would really apprecaite your help on this
Best regards
cfcoder