Spelling or syntax problem with SQL

J

JonR

Hi

I am getting an error "The SELECT statement contains a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect"

I'm really new to using SQL, and obviously forced to use it with a union query. I don't know what exactly I'm looking for or where to find it.

What this query is supposed to do is find all the service requests and associate them with the most recent date. This will be either d_date_submitted or d_app_x_impacted_date. The d_app_x_impacted_date will invariably be later than d_date_submitted, but does not exist for all records. My ultimate output needs to be a list of all service requests associated with the most recent of the two dates, with no duplication in the service requests.

Thanks in advance

SELECT DatePart("yyyy",[d_date_submitted]) AS [Year], DatePart("m",[d_date_submitted]), AS [Month], [dbo_srm_service_requests].[c_service_req]
FROM (dbo_srm_service_requests INNER JOIN dbo_srm_sr_appl_xref ON dbo_srm_service_requests.c_service_req = dbo_srm_sr_appl_xref.c_service_req) INNER JOIN dbo_chip_projects_by_app ON dbo_srm_service_requests.c_service_req = dbo_chip_projects_by_app.c_service_req
WHERE (((dbo_srm_service_requests.c_is_app_id)="ESM" Or (dbo_srm_service_requests.c_is_app_id)="ESMOPS" Or (dbo_srm_service_requests.c_is_app_id)="ESMBSS" Or (dbo_srm_service_requests.c_is_app_id)="ESMPM" Or (dbo_srm_service_requests.c_is_app_id)="ESMSMARTS" Or (dbo_srm_service_requests.c_is_app_id)="ESMTME" Or (dbo_srm_service_requests.c_is_app_id)=" ESMWO" Or (dbo_srm_service_requests.c_is_app_id)="INFOVISTA") AND ((dbo_srm_service_requests.c_project_type)="d")) OR (((dbo_srm_service_requests.c_project_type)="d") AND ((dbo_srm_sr_appl_xref.c_is_app_id)="ESM" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMOPS" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMBSS" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMPM" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMSMARTS" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMTME" Or (dbo_srm_sr_appl_xref.c_is_app_id)=" ESMWO" Or (dbo_srm_sr_appl_xref.c_is_app_id)="INFOVISTA"))

UNION SELECT DatePart("yyyy",[d_app_x_impacted_date]) AS [Year], DatePart("m",[d_app_x_impacted_date]), AS [Month],[ dbo_srm_service_requests].[c_service_req]
FROM ([dbo_srm_service_requests] INNER JOIN [dbo_srm_sr_appl_xref] ON [dbo_srm_service_requests].[c_service_req] =[ dbo_srm_sr_appl_xref].[c_service_req]) INNER JOIN [dbo_chip_projects_by_app] ON [dbo_srm_service_requests].[c_service_req] = [dbo_chip_projects_by_app].[c_service_req]

GROUP BY IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("yyyy",[d_date_submitted]),DatePart("yyyy",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("m",[d_date_submitted]),DatePart("m",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), dbo_srm_service_requests.c_service_req
ORDER BY IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("yyyy",[d_date_submitted]),DatePart("yyyy",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("m",[d_date_submitted]),DatePart("m",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), dbo_srm_service_requests.c_service_req;
 
N

Newbie

Try changing AS [Year] and AS [Month] to for eg SubmitYr and SubmitMth
JonR said:
Hi

I am getting an error "The SELECT statement contains a reserved word or an
argument name that is misspelled or missing, or the punctuation is
incorrect"
I'm really new to using SQL, and obviously forced to use it with a union
query. I don't know what exactly I'm looking for or where to find it.
What this query is supposed to do is find all the service requests and
associate them with the most recent date. This will be either
d_date_submitted or d_app_x_impacted_date. The d_app_x_impacted_date will
invariably be later than d_date_submitted, but does not exist for all
records. My ultimate output needs to be a list of all service requests
associated with the most recent of the two dates, with no duplication in the
service requests.
Thanks in advance

SELECT DatePart("yyyy",[d_date_submitted]) AS [Year],
DatePart("m",[d_date_submitted]), AS [Month],
[dbo_srm_service_requests].[c_service_req]
FROM (dbo_srm_service_requests INNER JOIN dbo_srm_sr_appl_xref ON
dbo_srm_service_requests.c_service_req = dbo_srm_sr_appl_xref.c_service_req)
INNER JOIN dbo_chip_projects_by_app ON
dbo_srm_service_requests.c_service_req =
dbo_chip_projects_by_app.c_service_req
WHERE (((dbo_srm_service_requests.c_is_app_id)="ESM" Or
(dbo_srm_service_requests.c_is_app_id)="ESMOPS" Or
(dbo_srm_service_requests.c_is_app_id)="ESMBSS" Or
(dbo_srm_service_requests.c_is_app_id)="ESMPM" Or
(dbo_srm_service_requests.c_is_app_id)="ESMSMARTS" Or
(dbo_srm_service_requests.c_is_app_id)="ESMTME" Or
(dbo_srm_service_requests.c_is_app_id)=" ESMWO" Or
(dbo_srm_service_requests.c_is_app_id)="INFOVISTA") AND
((dbo_srm_service_requests.c_project_type)="d")) OR
(((dbo_srm_service_requests.c_project_type)="d") AND
((dbo_srm_sr_appl_xref.c_is_app_id)="ESM" Or
(dbo_srm_sr_appl_xref.c_is_app_id)="ESMOPS" Or
(dbo_srm_sr_appl_xref.c_is_app_id)="ESMBSS" Or
(dbo_srm_sr_appl_xref.c_is_app_id)="ESMPM" Or
(dbo_srm_sr_appl_xref.c_is_app_id)="ESMSMARTS" Or
(dbo_srm_sr_appl_xref.c_is_app_id)="ESMTME" Or
(dbo_srm_sr_appl_xref.c_is_app_id)=" ESMWO" Or
(dbo_srm_sr_appl_xref.c_is_app_id)="INFOVISTA"))
UNION SELECT DatePart("yyyy",[d_app_x_impacted_date]) AS [Year],
DatePart("m",[d_app_x_impacted_date]), AS [Month],[
dbo_srm_service_requests].[c_service_req]
FROM ([dbo_srm_service_requests] INNER JOIN [dbo_srm_sr_appl_xref] ON
[dbo_srm_service_requests].[c_service_req] =[
dbo_srm_sr_appl_xref].[c_service_req]) INNER JOIN [dbo_chip_projects_by_app]
ON [dbo_srm_service_requests].[c_service_req] =
[dbo_chip_projects_by_app].[c_service_req]
IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("yyy
y",[d_date_submitted]),DatePart("yyyy",[dbo_chip_projects_by_app].[d_app_x_i
mpacted_date])),
IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("m",
[d_date_submitted]),DatePart("m",[dbo_chip_projects_by_app].[d_app_x_impacte
d_date])), dbo_srm_service_requests.c_service_req
IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("yyy
y",[d_date_submitted]),DatePart("yyyy",[dbo_chip_projects_by_app].[d_app_x_i
mpacted_date])),
IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("m",
[d_date_submitted]),DatePart("m",[dbo_chip_projects_by_app].[d_app_x_impacte
d_date])), dbo_srm_service_requests.c_service_req;
 
J

Jeff Boyce

Jon

A quick glance at your SQL statement showed [Year] and [Month] -- even
though you've em-bracketed these, the words are reserved word in Access, and
may be causing your error. Retry what you have, with those renamed
(?[MyYear], [MyMonth], or something more meaningful).
 
J

John Spencer (MVP)

First, let's make that a little more readable. After redoing the first part, I
can see that you have some extra commas, and possibly an extra space. Also, you
could probably rewrite the WHERE clause using the IN operator instead of all the
equals and ors.

SELECT DatePart("yyyy",[d_date_submitted]) AS [Year],
DatePart("m",[d_date_submitted]), AS [Month], <---- NOTE THE EXTRA COMMA
HERE BEFORE THE AS
[dbo_srm_service_requests].[c_service_req]
FROM (dbo_srm_service_requests INNER JOIN
dbo_srm_sr_appl_xref
ON dbo_srm_service_requests.c_service_req =
dbo_srm_sr_appl_xref.c_service_req)
INNER JOIN dbo_chip_projects_by_app
ON dbo_srm_service_requests.c_service_req = dbo_chip_projects_by_app.c_service_req
WHERE (
(dbo_srm_service_requests.c_is_app_id
In ("ESM","ESMOPS","ESMBSS" ,"ESMPM","ESMSMARTS","ESMTME",
" ESMWO", <----- NOTE SPACE before ESMWO
"INFOVISTA") OR
dbo_srm_sr_appl_xref.c_is_app_id
In ("ESM","ESMOPS","ESMBSS" ,"ESMPM","ESMSMARTS","ESMTME",
" ESMWO", <----- NOTE SPACE before ESMWO
"INFOVISTA"))
AND dbo_srm_service_requests.c_project_type="d"


UNION
....
DatePart("m",[d_app_x_impacted_date]), AS [Month], <---- NOTE THE EXTRA COMMA
HERE BEFORE THE AS
....
GROUP BY Year(NZ([dbo_chip_projects_by_app].[d_app_x_impacted_date],[d_date_submitted])),
Month(NZ([dbo_chip_projects_by_app].[d_app_x_impacted_date],[d_date_submitted])),
dbo_srm_service_requests.c_service_req
ORDER BY
....


Hi

I am getting an error "The SELECT statement contains a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect"

I'm really new to using SQL, and obviously forced to use it with a union query. I don't know what exactly I'm looking for or where to find it.

What this query is supposed to do is find all the service requests and associate them with the most recent date. This will be either d_date_submitted or d_app_x_impacted_date. The d_app_x_impacted_date will invariably be later than d_date_submitted, but does not exist for all records. My ultimate output needs to be a list of all service requests associated with the most recent of the two dates, with no duplication in the service requests.

Thanks in advance

SELECT DatePart("yyyy",[d_date_submitted]) AS [Year], DatePart("m",[d_date_submitted]), AS [Month], [dbo_srm_service_requests].[c_service_req]
FROM (dbo_srm_service_requests INNER JOIN dbo_srm_sr_appl_xref ON dbo_srm_service_requests.c_service_req = dbo_srm_sr_appl_xref.c_service_req) INNER JOIN dbo_chip_projects_by_app ON dbo_srm_service_requests.c_service_req = dbo_chip_projects_by_app.c_service_req
WHERE (((dbo_srm_service_requests.c_is_app_id)="ESM" Or (dbo_srm_service_requests.c_is_app_id)="ESMOPS" Or (dbo_srm_service_requests.c_is_app_id)="ESMBSS" Or (dbo_srm_service_requests.c_is_app_id)="ESMPM" Or (dbo_srm_service_requests.c_is_app_id)="ESMSMARTS" Or (dbo_srm_service_requests.c_is_app_id)="ESMTME" Or (dbo_srm_service_requests.c_is_app_id)=" ESMWO" Or (dbo_srm_service_requests.c_is_app_id)="INFOVISTA") AND ((dbo_srm_service_requests.c_project_type)="d")) OR (((dbo_srm_service_requests.c_project_type)="d") AND ((dbo_srm_sr_appl_xref.c_is_app_id)="ESM" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMOPS" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMBSS" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMPM" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMSMARTS" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMTME" Or (dbo_srm_sr_appl_xref.c_is_app_id)=" ESMWO" Or (dbo_srm_sr_appl_xref.c_is_app_id)="INFOVISTA"))

UNION SELECT DatePart("yyyy",[d_app_x_impacted_date]) AS [Year], DatePart("m",[d_app_x_impacted_date]), AS [Month],[ dbo_srm_service_requests].[c_service_req]
FROM ([dbo_srm_service_requests] INNER JOIN [dbo_srm_sr_appl_xref] ON [dbo_srm_service_requests].[c_service_req] =[ dbo_srm_sr_appl_xref].[c_service_req]) INNER JOIN [dbo_chip_projects_by_app] ON [dbo_srm_service_requests].[c_service_req] = [dbo_chip_projects_by_app].[c_service_req]

GROUP BY IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("yyyy",[d_date_submitted]),DatePart("yyyy",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("m",[d_date_submitted]),DatePart("m",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), dbo_srm_service_requests.c_service_req
ORDER BY IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("yyyy",[d_date_submitted]),DatePart("yyyy",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("m",[d_date_submitted]),DatePart("m",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), dbo_srm_service_requests.c_service_req;
 
J

John Spencer (MVP)

Ok, let's troubleshoot this step by step. I think that your ORDER BY clause is
the culprit. Try Dropping it or changing it to

ORDER BY DatePart("yyyy",[d_date_submitted]), DatePart("m",[d_date_submitted]),
[dbo_srm_service_requests].[c_service_req]

OR Even this abbreviated format

ORDER BY 1,2,3

Try running each part of the union as separate queries and see if you get any
error there. If so, clean up the errors on that part. Once you have the two
parts running, you should be able to recombine them into one query.

Your GROUP BY also looks suspect. Why are you trying to do a GROUP BY? AND are
you trying to do it on the UNION of the two queries? If you are attempting to
just get unique records then you can drop the group by completely. A Union (as
opposed to a UNION ALL) query returns distinct records (that is it combines rows
that have all the same values in the fields across the entire record).

So I think that you probably could delete the GROUP BY.

SELECT DatePart("yyyy",[d_date_submitted]) AS [Year_Submitted],
DatePart("m",[d_date_submitted]) AS [Month_Submitted],
[dbo_srm_service_requests].[c_service_req] AS [SR #]
FROM (dbo_srm_service_requests INNER JOIN dbo_srm_sr_appl_xref ON
dbo_srm_service_requests.c_service_req =
dbo_srm_sr_appl_xref.c_service_req) INNER JOIN dbo_chip_projects_by_app ON
dbo_srm_service_requests.c_service_req =
dbo_chip_projects_by_app.c_service_req
WHERE (dbo_srm_service_requests.c_is_app_id In ("ESM","ESMOPS","ESMBSS","ESMPM","ESMSMARTS","ESMTME","ESMWO","INFOVISTA"))

UNION SELECT DatePart("yyyy",[d_app_x_impacted_date]) AS [Year_Submitted],
DatePart("m",[d_app_x_impacted_date]) AS
[Month_Submitted],[dbo_srm_service_requests].[c_service_req] AS [SR #]
FROM (dbo_srm_service_requests INNER JOIN dbo_srm_sr_appl_xref ON
dbo_srm_service_requests.c_service_req =
dbo_srm_sr_appl_xref.c_service_req) INNER JOIN dbo_chip_projects_by_app ON
dbo_srm_service_requests.c_service_req =
dbo_chip_projects_by_app.c_service_req


ORDER BY 1,2,3
Hi

I cleaned up the code according to your speficications, and changed the names of the output fields, since Year and Month are reserved words. Now the SQL is giving me an error "Syntax Error (missing operator) in query expression 'DatePart("yyyy",[d_date_submitted]) AS [Year_Submitted]. It seems to be stopping in the GROUP BY area of the code, so I'm pretty sure I'll have a similar error when it gets into the Month_Submitted group. I hope this isn't too painful for you, since I'm very new to SQL and don't know anything about the syntax or operators.

Here's the new SQL

SELECT DatePart("yyyy",[d_date_submitted]) AS [Year_Submitted], DatePart("m",[d_date_submitted]) AS [Month_Submitted], [dbo_srm_service_requests].[c_service_req] AS [SR #]
FROM (dbo_srm_service_requests INNER JOIN dbo_srm_sr_appl_xref ON dbo_srm_service_requests.c_service_req = dbo_srm_sr_appl_xref.c_service_req) INNER JOIN dbo_chip_projects_by_app ON dbo_srm_service_requests.c_service_req = dbo_chip_projects_by_app.c_service_req
WHERE (dbo_srm_service_requests.c_is_app_id In ("ESM","ESMOPS","ESMBSS","ESMPM","ESMSMARTS","ESMTME","ESMWO","INFOVISTA"))

UNION SELECT DatePart("yyyy",[d_app_x_impacted_date]) AS [Year_Submitted], DatePart("m",[d_app_x_impacted_date]) AS [Month_Submitted],[dbo_srm_service_requests].[c_service_req] AS [SR #]
FROM (dbo_srm_service_requests INNER JOIN dbo_srm_sr_appl_xref ON dbo_srm_service_requests.c_service_req = dbo_srm_sr_appl_xref.c_service_req) INNER JOIN dbo_chip_projects_by_app ON dbo_srm_service_requests.c_service_req = dbo_chip_projects_by_app.c_service_req

GROUP BY Year_Submitted(NZ([dbo_chip_projects_by_app].[d_app_x_impacted_date],[d_date_submitted])),Month_submitted(NZ([dbo_chip_projects_by_app].[d_app_x_impacted_date],[d_date_submitted])),dbo_srm_service_requests.c_service_req

ORDER BY DatePart("yyyy",[d_date_submitted]) AS [Year_Submitted], DatePart("m",[d_date_submitted]) AS [Month_Submitted], [dbo_srm_service_requests].[c_service_req] AS [SR #]

John Spencer (MVP) said:
First, let's make that a little more readable. After redoing the first part, I
can see that you have some extra commas, and possibly an extra space. Also, you
could probably rewrite the WHERE clause using the IN operator instead of all the
equals and ors.

SELECT DatePart("yyyy",[d_date_submitted]) AS [Year],
DatePart("m",[d_date_submitted]), AS [Month], <---- NOTE THE EXTRA COMMA
HERE BEFORE THE AS
[dbo_srm_service_requests].[c_service_req]
FROM (dbo_srm_service_requests INNER JOIN
dbo_srm_sr_appl_xref
ON dbo_srm_service_requests.c_service_req =
dbo_srm_sr_appl_xref.c_service_req)
INNER JOIN dbo_chip_projects_by_app
ON dbo_srm_service_requests.c_service_req = dbo_chip_projects_by_app.c_service_req
WHERE (
(dbo_srm_service_requests.c_is_app_id
In ("ESM","ESMOPS","ESMBSS" ,"ESMPM","ESMSMARTS","ESMTME",
" ESMWO", <----- NOTE SPACE before ESMWO
"INFOVISTA") OR
dbo_srm_sr_appl_xref.c_is_app_id
In ("ESM","ESMOPS","ESMBSS" ,"ESMPM","ESMSMARTS","ESMTME",
" ESMWO", <----- NOTE SPACE before ESMWO
"INFOVISTA"))
AND dbo_srm_service_requests.c_project_type="d"


UNION
....
DatePart("m",[d_app_x_impacted_date]), AS [Month], <---- NOTE THE EXTRA COMMA
HERE BEFORE THE AS
....
GROUP BY Year(NZ([dbo_chip_projects_by_app].[d_app_x_impacted_date],[d_date_submitted])),
Month(NZ([dbo_chip_projects_by_app].[d_app_x_impacted_date],[d_date_submitted])),
dbo_srm_service_requests.c_service_req
ORDER BY
....


Hi

I am getting an error "The SELECT statement contains a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect"

I'm really new to using SQL, and obviously forced to use it with a union query. I don't know what exactly I'm looking for or where to find it.

What this query is supposed to do is find all the service requests and associate them with the most recent date. This will be either d_date_submitted or d_app_x_impacted_date. The d_app_x_impacted_date will invariably be later than d_date_submitted, but does not exist for all records. My ultimate output needs to be a list of all service requests associated with the most recent of the two dates, with no duplication in the service requests.

Thanks in advance

SELECT DatePart("yyyy",[d_date_submitted]) AS [Year], DatePart("m",[d_date_submitted]), AS [Month], [dbo_srm_service_requests].[c_service_req]
FROM (dbo_srm_service_requests INNER JOIN dbo_srm_sr_appl_xref ON dbo_srm_service_requests.c_service_req = dbo_srm_sr_appl_xref.c_service_req) INNER JOIN dbo_chip_projects_by_app ON dbo_srm_service_requests.c_service_req = dbo_chip_projects_by_app.c_service_req
WHERE (((dbo_srm_service_requests.c_is_app_id)="ESM" Or (dbo_srm_service_requests.c_is_app_id)="ESMOPS" Or (dbo_srm_service_requests.c_is_app_id)="ESMBSS" Or (dbo_srm_service_requests.c_is_app_id)="ESMPM" Or (dbo_srm_service_requests.c_is_app_id)="ESMSMARTS" Or (dbo_srm_service_requests.c_is_app_id)="ESMTME" Or (dbo_srm_service_requests.c_is_app_id)=" ESMWO" Or (dbo_srm_service_requests.c_is_app_id)="INFOVISTA") AND ((dbo_srm_service_requests.c_project_type)="d")) OR (((dbo_srm_service_requests.c_project_type)="d") AND ((dbo_srm_sr_appl_xref.c_is_app_id)="ESM" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMOPS" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMBSS" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMPM" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMSMARTS" Or (dbo_srm_sr_appl_xref.c_is_app_id)="ESMTME" Or (dbo_srm_sr_appl_xref.c_is_app_id)=" ESMWO" Or (dbo_srm_sr_appl_xref.c_is_app_id)="INFOVISTA"))

UNION SELECT DatePart("yyyy",[d_app_x_impacted_date]) AS [Year], DatePart("m",[d_app_x_impacted_date]), AS [Month],[ dbo_srm_service_requests].[c_service_req]
FROM ([dbo_srm_service_requests] INNER JOIN [dbo_srm_sr_appl_xref] ON [dbo_srm_service_requests].[c_service_req] =[ dbo_srm_sr_appl_xref].[c_service_req]) INNER JOIN [dbo_chip_projects_by_app] ON [dbo_srm_service_requests].[c_service_req] = [dbo_chip_projects_by_app].[c_service_req]

GROUP BY IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("yyyy",[d_date_submitted]),DatePart("yyyy",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("m",[d_date_submitted]),DatePart("m",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), dbo_srm_service_requests.c_service_req
ORDER BY IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("yyyy",[d_date_submitted]),DatePart("yyyy",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), IIf(IsNull([dbo_chip_projects_by_app].[d_app_x_impacted_date]),DatePart("m",[d_date_submitted]),DatePart("m",[dbo_chip_projects_by_app].[d_app_x_impacted_date])), dbo_srm_service_requests.c_service_req;
 
Top