Home » Developer & Programmer » Forms » How to select 1st record from the duplicate values in a table without using rownum and rowid (Forms 10g, SQL)
How to select 1st record from the duplicate values in a table without using rownum and rowid [message #452737] Fri, 23 April 2010 13:05 Go to next message
meena.g
Messages: 14
Registered: February 2010
Location: Hyderabad (A.P)
Junior Member
Hi,

how to select 1st record from duplicate vales in a table.

If we created one table with out primary key column
In form in search block have uwi value and top_depth value
when i enter uwi and top_depth value then when i click search button then it will display all values in master block.

but here duplicate values r there.
SQL> select rownum,uwi,top_depth,base_depth,test_start_date from well_pre_header;

    ROWNUM UWI               TOP_DEPTH BASE_DEPTH TEST_STAR
---------- ---------------- ---------- ---------- ---------
         1 100                  453.05     458.08 09-SEP-10
         2 100                     200        288 23-AUG-00
         3 1001                    200        289 25-AUG-01
         4 1001                    200        201 24-MAY-87

if uwi = 1001 and top_depth=200 and i will click search button it should be display 3 record & when i click next button then it will show 4th record.

please help me how to do solve that problem

[Topic title changed after dozen of topics have been merged. Applied [code] tags]

[Updated on: Fri, 23 April 2010 15:24] by Moderator

Report message to a moderator

Re: How to select 1st record from the duplicate values in a table without using rownum and rowid [message #452750 is a reply to message #452737] Fri, 23 April 2010 15:27 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Set ORDER BY block property so that query returns records in desired order.
Re: How to select 1st record from the duplicate values in a table without using rownum and rowid [message #452824 is a reply to message #452750] Sun, 25 April 2010 01:08 Go to previous messageGo to next message
meena.g
Messages: 14
Registered: February 2010
Location: Hyderabad (A.P)
Junior Member
Hi Friends,

I am not getting that point can u explain briefly?

Thanks in advance.
Re: How to select 1st record from the duplicate values in a table without using rownum and rowid [message #452830 is a reply to message #452824] Sun, 25 April 2010 04:11 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Based on sample data you provided, querying (<Enter query>, enter 1001 into UWI item and 200 into TOP_DEPTH item, <Execute query>) will return all records that satisfy this condition:
    ROWNUM UWI               TOP_DEPTH BASE_DEPTH TEST_STAR
---------- ---------------- ---------- ---------- ---------
         3 1001                    200        289 25-AUG-01
         4 1001                    200        201 24-MAY-87
As you want to display record 3 first and 4 after it, you'd put "ORDER BY BASE_DEPTH DESC" or "ORDER BY TEST_STAR DESC" into the ORDER BY block property. (Perhaps I'm wrong, but - as you didn't use ORDER BY in SELECT statement, I don't know how these records should be sorted - you know it, I believe).

Once you do that, <Next record> button (in Forms toolbar) (or key-down key on the keyboard or ...) will fetch the next record(s).
Previous Topic: Change the color of active/inactive Tab Canvas
Next Topic: Hiding Window failing on forms 6i.
Goto Forum:
  


Current Time: Fri Sep 20 05:37:26 CDT 2024