PRatcliff schrieb:
> Hello,
>
[quoted text clipped - 8 lines]
> THEN A.datefieldA BETWEEN @startdate AND @enddate
> ELSE B.datefieldB BETWEEN @startdate AND @enddate END
[...]
> I know I can't use CASE in the above fashion, but I want to use a
> single query to pull data where the 'where' field can change depending
[quoted text clipped - 3 lines]
> Thanks in advance & cheers,
> PRatcliff
SELECT *
FROM tableA A
join tableB B
on A.idfield = B.idfield
WHERE (@userinput =A AND A.datefieldA BETWEEN @startdate AND @enddate)
OR (@userinput!=A AND B.datefieldB BETWEEN @startdate AND @enddate)
HTH
Wilhelm
PRatcliff - 24 Feb 2004 18:14 GMT
Wilhelm,
All I can say is 'duh'. It seems so obvious now I see it. Another
gaping hole in my SQL knowledge is filled. Vielen Dank
PRatcliff
> PRatcliff schrieb:
> > Hello,
[quoted text clipped - 29 lines]
> HTH
> Wilhelm