A
AJ
Hi all, I have the following query which isn't quite finished!
1) How do i specify the '@Country' parameter is optional in an ACCESS stored
query? (like MSSQL @Country INT = NULL)
2) What is the Access Equivalent of the following AND CLAUSE ?
AND
c.Country = Coalesce(@Country, c.Country)
Query involved below:
SELECT DISTINCT
c.ID, c.Company_Name, p.[level], 1 As QueryNbr
FROM
(Company AS c LEFT JOIN Sale AS s ON c.ID = s.Company_ID)
LEFT JOIN
Package AS p
ON
s.Package_ID = p.ID
WHERE
c.Category = 'EXH'
AND
(s.ID = (SELECT Max(ID) FROM Sale WHERE Company_ID = c.ID) Or IsNull(s.ID)
AND
EXISTS(SELECT Company_ID FROM Event_Company_Link WHERE Event_ID =
@EventID AND Company_ID = c.ID)
AND
EXISTS(SELECT Company_ID FROM Company_Product_Link WHERE Product_ID =
@Products AND Company_ID = c.ID)
AND
(Start_Date <= Date()+1) AND (End_Date >= Date()+1)
AND
c.Country = /* Need Access equivalent of Coalesce(@Country, c.Country) */
Cheers,
Adam
1) How do i specify the '@Country' parameter is optional in an ACCESS stored
query? (like MSSQL @Country INT = NULL)
2) What is the Access Equivalent of the following AND CLAUSE ?
AND
c.Country = Coalesce(@Country, c.Country)
Query involved below:
SELECT DISTINCT
c.ID, c.Company_Name, p.[level], 1 As QueryNbr
FROM
(Company AS c LEFT JOIN Sale AS s ON c.ID = s.Company_ID)
LEFT JOIN
Package AS p
ON
s.Package_ID = p.ID
WHERE
c.Category = 'EXH'
AND
(s.ID = (SELECT Max(ID) FROM Sale WHERE Company_ID = c.ID) Or IsNull(s.ID)
AND
EXISTS(SELECT Company_ID FROM Event_Company_Link WHERE Event_ID =
@EventID AND Company_ID = c.ID)
AND
EXISTS(SELECT Company_ID FROM Company_Product_Link WHERE Product_ID =
@Products AND Company_ID = c.ID)
AND
(Start_Date <= Date()+1) AND (End_Date >= Date()+1)
AND
c.Country = /* Need Access equivalent of Coalesce(@Country, c.Country) */
Cheers,
Adam