Home » SQL & PL/SQL » SQL & PL/SQL » Tuning Query
icon9.gif  Tuning Query [message #225746] Wed, 21 March 2007 04:21 Go to next message
feizz
Messages: 16
Registered: December 2006
Location: Singapore
Junior Member

Hi there,
please help me to tune this query as i need only one record appear instead a group of records.
All i need is to get one record per CBBUNO.

Thanks

SQL :
SELECT A.CBBUNO, A.CBCTCD, A.CBBUAM, A.CBACAM, A.CBUNAM,B.CBCTCDDESCR,C.FNTXT1, C.FNASID, C.FNAPER
FROM CAPEXPDMV A, CAPEXPREFRTAB B, FFASNTMV C
WHERE A.CBDIVI = 100
AND A.CBYEAR = 2007
AND A.CBDIVI = B.CBDIVI
AND RTRIM(A.CBCTCD) = RTRIM(B.CBCTCD)
AND RTRIM(B.CBDIVI) = 100
AND B.CBDEPTB = 'Test Planning'
AND RTRIM(A.CBBUNO) = RTRIM(C.FNAIT7(+));

RESULTS:
CBBUNO CBCTCD CBBUAM CBACAM CBUNAM CBCTCDDESCR FNTXT1 FNASID FNAPER
BUD07110 200701 7,750 6,695 0 TEST PL,SENSOR SELL OPTIPLEX 745 DESKTOP PC A0386 200,701
BUD07110 200701 7,750 6,695 0 TEST PL,SENSOR SELL OPTIPLEX 745 DESKTOP PC A0387 200,701
BUD07110 200701 7,750 6,695 0 TEST PL,SENSOR SELL OPTIPLEX 745 DESKTOP PC A0388 200,701
BUD07110 200701 7,750 6,695 0 TEST PL,SENSOR SELL OPTIPLEX 745 DESKTOP PC A0389 200,701
BUD07110 200701 7,750 6,695 0 TEST PL,SENSOR SELL OPTIPLEX 745 DESKTOP PC A0390 200,701
BUD07092 200705 10,849 10,957 0 TEST PL,DEVICE DELL OPTIPLEX 745 DESKTOP PC A0391 200,701
BUD07092 200705 10,849 10,957 0 TEST PL,DEVICE DELL OPTIPLEX 745 DESKTOP PC A0392 200,701
BUD07092 200705 10,849 10,957 0 TEST PL,DEVICE DELL OPTIPLEX 745 DESKTOP PC A0393 200,701
BUD07092 200705 10,849 10,957 0 TEST PL,DEVICE DELL OPTIPLEX 745 DESKTOP PC A0394 200,701
BUD07092 200705 10,849 10,957 0 TEST PL,DEVICE DELL OPTIPLEX 745 DESKTOP PC A0395 200,701
BUD07092 200705 10,849 10,957 0 TEST PL,DEVICE DELL OPTIPLEX 745 DESKTOP PC A0396 200,701
BUD07092 200705 10,849 10,957 0 TEST PL,DEVICE DELL OPTIPLEX 745 DESKTOP PC A0397 200,701
BUD07096 200704 7,750 8,495 0 TEST PL,SMT DELL OPTIPLEX 745 DESKTOP A0398 200,701
BUD07096 200704 7,750 8,495 0 TEST PL,SMT DELL OPTIPLEX 745 DESKTOP A0399 200,701
BUD07096 200704 7,750 8,495 0 TEST PL,SMT DELL OPTIPLEX 745 DESKTOP A0400 200,701
BUD07096 200704 7,750 8,495 0 TEST PL,SMT DELL OPTIPLEX 745 DESKTOP A0401 200,701
BUD07096 200704 7,750 8,495 0 TEST PL,SMT DELL OPTIPLEX 745 DESKTOP A0402 200,701
BUD07092 200705 10,849 10,957 0 TEST PL,DEVICE HP COLOR LASERJET 3800N PRINTER A0407 200,701
BUD07101 200704 1,550 1,584 0 TEST PL,SMT HP COLOR LASERJET 3800N PRINTER A0408 200,701




Re: Tuning Query [message #225773 is a reply to message #225746] Wed, 21 March 2007 06:47 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Would SELECT DISTINCT ... help?
Re: Tuning Query [message #225917 is a reply to message #225773] Wed, 21 March 2007 23:17 Go to previous messageGo to next message
feizz
Messages: 16
Registered: December 2006
Location: Singapore
Junior Member

Hi Littlefoot,
thanks for your reply, all i need is to display at least only one record from the group of 1st 5 lines.
I couldn't use distinct.
Please help.


Regards, Faizal
Re: Tuning Query [message #225952 is a reply to message #225917] Thu, 22 March 2007 01:30 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
select min(FNTXT1) and group by the other columns
Previous Topic: Urgent: creating a record in RAC
Next Topic: get all non system tables & views
Goto Forum:
  


Current Time: Thu Dec 08 16:30:22 CST 2016

Total time taken to generate the page: 0.11211 seconds