Home » SQL & PL/SQL » SQL & PL/SQL » funcation date (-)
funcation date (-) [message #379109] Sun, 04 January 2009 23:41 Go to next message
CLS63AMGV8
Messages: 11
Registered: November 2008
Location: Oman
Junior Member
hi guys how are you
i want to (-) but gave me mistake

create view vw_search_rooms as
SELECT BookIngs1.g_Id,
BookIngs1.Date_From,
BookIngs1.Date_To,
Room_Types1.Room_desc,
Room_Types1.Room_Rate,
Rooms1.Room_No,
Rooms1.r_Floor,
Rooms1.r_Suite,
Rooms1.Reserved,
Rooms1.Room_tc,
Rooms1.b_Id,
(sysdate Bookings1.Date_To - Bookings1.Date_From) AS Nights, (Room_Types1.Room_Rate * Nights) AS Total_Amounts
FROM Room_Types1
INNER JOIN (BookIngs1
INNER JOIN Rooms1
ON BookIngs1.b_Id = Rooms1.b_Id)
ON Room_Types1.Room_tc = Rooms1.Room_tc;
Re: funcation date (-) [message #379111 is a reply to message #379109] Sun, 04 January 2009 23:46 Go to previous messageGo to next message
BlackSwan
Messages: 25045
Registered: January 2009
Location: SoCal
Senior Member
You have table & provided us no DDL for it.
You have data & provided us no DML for test data.

http://www.orafaq.com/forum/t/88153/0/
You have not read or followed Posting Guideline as stated in URL above.

You have not shown us via CUT & PASTE what you actually did or how Oracle responded.

You have not provided any expected output.

You're On Your Own (YOYO)!

>i want to (-) but gave me mistake

Mistake? what mistake? I don't see any mistake.
Re: funcation date (-) [message #379127 is a reply to message #379109] Mon, 05 January 2009 00:33 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Just read what you wrote in blue.
What is the meaning of (for instance, taking a date for each variable):
05/01/2009 10/12/2008 - 1/11/2008

Regards
Michel
Re: funcation date (-) [message #379185 is a reply to message #379127] Mon, 05 January 2009 05:17 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Additionally, you cannot use an alias for a column in the same level that you define that alias in.

Ie In your select list you have:
,(Bookings1.Date_To - ,Bookings1.Date_From) AS Nights
,(Room_Types1.Room_Rate * Nights) AS Total_Amounts

You cannot refer to Nights in the Total_Amounts column - you'd have to repeast the calculation used to create it.
Previous Topic: Number format
Next Topic: Creating primary key
Goto Forum:
  


Current Time: Wed Dec 07 16:38:46 CST 2016

Total time taken to generate the page: 0.08534 seconds