Home » SQL & PL/SQL » SQL & PL/SQL » need help in sql query (merged by CM) (oracle 10g)
need help in sql query (merged by CM) [message #447014] Thu, 11 March 2010 10:05 Go to next message
brad23
Messages: 2
Registered: March 2010
Junior Member
I have a table with Columns as as below

id number primary key,
object_name varchar2(100),
object_value varchar2(100)

Data is stored as follows

id object_name object_value
-----------------------------------
10 prop_num 436
20 city dallas
40 Misc 1 90
50 Misc 1 desc min amount
60 Misc 2 700
70 Misc 2 desc interest amount
80 Misc 3
80 Misc 3 desc

SQL should return result as shown below

id object_name object_value
-----------------------------------
10 prop_num 436
20 city dallas
40 min amount 90
50 interest amount700


I have done this through plsql code by creating temp table. But I need to do it in a sql query. I am stuck here

Any pointers/help is appreciated

Thanks
Re: Need help with sql query [message #447018 is a reply to message #447014] Thu, 11 March 2010 10:11 Go to previous messageGo to next message
cookiemonster
Messages: 12320
Registered: September 2008
Location: Rainy Manchester
Senior Member
First off you need to format your data so we can actually tell which bits of data belong to which columns. Repost with code tags - see the orafaq forum guide if you're not sure how.

Secondly you're going to have to explain the logic of the result. I can't see why interest amount would appear with id 50 in the result when it's got id 70 in the table.
Re: need help in sql query (merged by CM) [message #447028 is a reply to message #447014] Thu, 11 March 2010 10:48 Go to previous message
Michel Cadot
Messages: 63806
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
If you post a working Test case: create table and insert statements along with the result you want with these data, we will be able to work with them.

Before please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.

Regards
Michel
Previous Topic: Cookie remove / add / read
Next Topic: Outer join with cut-off condition
Goto Forum:
  


Current Time: Wed Sep 28 04:04:24 CDT 2016

Total time taken to generate the page: 0.11164 seconds