Subject | It is possible to change select of the wiev by where clause |
---|---|
Author | Tommi Prami |
Post date | 2008-10-21T09:37:31Z |
Hello,
we would need something like this.
select * from view_something where contractorid=10
(let's say) if ContractorId is 10 we can select directly form Table-X.
if ContractorId<>10 we must do much more complex join which would cause
doublicate rows in case of contractorid=10.
I am not too much of an SQL goy, but I can provide more information if need.
But is there way to do two or more separate set's of SQL in view depending
on the where clause, different joins etc...
I think with UNION you can do this depending on the selected data, but how
about the where clause. (stored progs are out of the question, unless it
could be used trough view. select * from view_something where
contractorid=10 would actually select data from proc_something hich would
have some case or if which would deal case descripend (poorly) above).
-TP-
we would need something like this.
select * from view_something where contractorid=10
(let's say) if ContractorId is 10 we can select directly form Table-X.
if ContractorId<>10 we must do much more complex join which would cause
doublicate rows in case of contractorid=10.
I am not too much of an SQL goy, but I can provide more information if need.
But is there way to do two or more separate set's of SQL in view depending
on the where clause, different joins etc...
I think with UNION you can do this depending on the selected data, but how
about the where clause. (stored progs are out of the question, unless it
could be used trough view. select * from view_something where
contractorid=10 would actually select data from proc_something hich would
have some case or if which would deal case descripend (poorly) above).
-TP-