jscontreras
Programmer
Hi All,
I have an issue with an SELECT statement:
I'm using ANSI SQL with a lot of outerjoins and they need to be compatible with SQL Server and Oracle. The problem is there a criteria screen that contains multiple parameters that need to be passed. Using the "Where" for the criteria will not worked because the outer joins need to be universal for both SQL Server and Oracle. The where clause is replace with HAVING and this is the problem.
How do I dynamically generate the HAVING Statement without knowing how many parameters are being passed. For example
Let's say I have:
SELECT a.projectID,b.ProjectManager,c.ProjectDescription
FROM (((Project a LEFT JOIN Person b ON a.PID = b.ID)
INNER JOIN ProjectDetails c on a.PID = c.PID)
Now if I have a parameter I need to display that parameter in not I'm done:
If I have a parameter I'll do the following:
HAVING (((a.PID IN(" & paramValues & "
"
What do I do if I have another one and what if the first paramater isn't pick but the third parameter? and I need to put in the correct number of parathesis in the having clause
I'm not really sure how to approach this problem I would appreciate any help.
Thanks
I have an issue with an SELECT statement:
I'm using ANSI SQL with a lot of outerjoins and they need to be compatible with SQL Server and Oracle. The problem is there a criteria screen that contains multiple parameters that need to be passed. Using the "Where" for the criteria will not worked because the outer joins need to be universal for both SQL Server and Oracle. The where clause is replace with HAVING and this is the problem.
How do I dynamically generate the HAVING Statement without knowing how many parameters are being passed. For example
Let's say I have:
SELECT a.projectID,b.ProjectManager,c.ProjectDescription
FROM (((Project a LEFT JOIN Person b ON a.PID = b.ID)
INNER JOIN ProjectDetails c on a.PID = c.PID)
Now if I have a parameter I need to display that parameter in not I'm done:
If I have a parameter I'll do the following:
HAVING (((a.PID IN(" & paramValues & "
What do I do if I have another one and what if the first paramater isn't pick but the third parameter? and I need to put in the correct number of parathesis in the having clause
I'm not really sure how to approach this problem I would appreciate any help.
Thanks