Home » SQL & PL/SQL » SQL & PL/SQL » Need help for SQL (Oracle 9i)
Need help for SQL [message #391967] Sun, 15 March 2009 08:37 Go to next message
salim_dba
Messages: 1
Registered: March 2009
Junior Member
I have tables called a ,b
select * from a;

ID    DATE
1     1-Mar-09
2     3-Mar-09
3     4-Mar-09

select  * from b;

ID    DATE_TIME 
1     1-Mar-09 1:00PM
1     1-Mar-09 2:00PM
1     1-Mar-09 3:00PM
1     2-Mar-09 12:00AM
3     4-Mar-09  9:00PM

I want to query which will get me result below.
ID     DATE_TIME              DATE

1     1-Mar-09 1:00PM         1-Mar-09
1     1-Mar-09 2:00PM         1-Mar-09
1     1-Mar-09 3:00PM         1-Mar-09
1     2-Mar-09 12:00AM        1-Mar-09
3     4-Mar-09  9:00PM        4-Mar-09

Could some one please help me to get it .

Thanks in Advance

[EDITED by LF: applied [code] tags; removed superfluous blank lines]

[Updated on: Sun, 15 March 2009 13:30] by Moderator

Report message to a moderator

Re: Need help for SQL [message #391970 is a reply to message #391967] Sun, 15 March 2009 09:27 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
Please read the OraFAQ Forum Guide for information on how to format your question.
Re: Need help for SQL [message #391971 is a reply to message #391967] Sun, 15 March 2009 09:40 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
TO_CHAR and follow the links.

Regards
Michel
Re: Need help for SQL [message #391989 is a reply to message #391967] Sun, 15 March 2009 13:28 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Regarding input and output data, it seems that it is about a simple JOIN (a.id = b.id). I believe that you should ba capable of writing the query by yourself. If not, please, post what you have tried so far; someone will certainly take a look and help.

(I didn't quite understand what TO_CHAR has to do with the issue).
Re: Need help for SQL [message #391990 is a reply to message #391989] Sun, 15 March 2009 13:57 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
(I didn't quite understand what TO_CHAR has to do with the issue).

How do you output a date in a specific format without TO_CHAR?
As OP didn't explain where is his problem, I choose that he does not know how to format a date/time.

Regards
Michel

[Updated on: Sun, 15 March 2009 13:58]

Report message to a moderator

Re: Need help for SQL [message #392037 is a reply to message #391990] Mon, 16 March 2009 02:34 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
@michel

i agree with @ebrain. OP has to follow the Guide lines provided.

without complete information no one will give him a correct solution.
@ Michecl
How can you suggest to_char,
esspecially for this

Quote:
ID DATE_TIME DATE

1 1-Mar-09 1:00PM 1-Mar-09
1 1-Mar-09 2:00PM 1-Mar-09
1 1-Mar-09 3:00PM 1-Mar-09
1 2-Mar-09 12:00AM 1-Mar-09
3 4-Mar-09 9:00PM 4-Mar-09

Re: Need help for SQL [message #392043 is a reply to message #392037] Mon, 16 March 2009 03:10 Go to previous message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
OP has to follow the Guide lines provided.

Wrong: it was not formatted and there is no question (just an output), no test case, no version with 4 decimals...

Quote:
How can you suggest to_char,
esspecially for this

How can you get this ouput without TO_CHAR. Show me.
Once again OP does not say if he is unable to find the join or to find how to output. You have your interpretation, I show there could be another one and there may be many other ones. Without a clear question, you can answer what you want.

Regards
Michel

Previous Topic: Maximum Date Data Type Size
Next Topic: Recursion
Goto Forum:
  


Current Time: Thu Dec 08 18:06:05 CST 2016

Total time taken to generate the page: 0.10588 seconds