YOu can not d what you want in a single select. You can do this in a stored procedure, or you can create 2 remote views based on:
create sql view rv_CountOf1DayAfter remote connection connect_name share as ;
SELECT Count(CustomerID) as CountOf1DayAfter ;
FROM sampleut1 ;
WHERE (DepartureDate - ArrivalDate) = 1
create sql view rv_CountOf2DayAfter remote connection connect_name share as ;
SELECT Count(CustomerID) as CountOf2DayAfter ;
FROM sampleut1 ;
WHERE (DepartureDate - ArrivalDate) = 2
Now just open the two views, and insert their values into the table.
>Mark,
> Actually i have two queries, i want to combine those two as one.That two queries are as follows.
>1.INSERT INTO sampleut2 SELECT Count(CustomerID) as CountOf1DayAfter FROM sampleut1 WHERE (DepartureDate - ArrivalDate) = 1
>2.SELECT Count(CustomerID) as CountOf2DaysAfter FROM sampleut1 WHERE (DepartureDate - ArrivalDate) = 2
>
> And i combined the above two queries as
>
>INSERT INTO sampleut2(CountOf1DayAfter,CountOf2DaysAfter)
> (SELECT Count(CustomerID) as CountOf1DayAfter FROM sampleut1 WHERE (DepartureDate - ArrivalDate) = 1,SELECT Count(CustomerID) as CountOf2DaysAfter FROM sampleut1 WHERE (DepartureDate - ArrivalDate)=2)
>
> Its giving syntax error.is it correct way.please tell me how to combine those two.
> Thanks.
Mark McCasland
Midlothian, TX USA