Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Please tell me
Message
 
 
To
19/01/2002 01:43:18
General information
Forum:
Oracle
Category:
Other
Title:
Miscellaneous
Thread ID:
00606595
Message ID:
00607249
Views:
22
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform