How to choose the lowest value of the record

I would return the lowest bidder of the recording of the same rental date and call number.
  SELECT   v.vendor "Vendor Id", INITCAP (v.vnames) "Vendor Name", B.DATELET "Letting Date" ,d.call "Call Number",
                  TO_CHAR (d.calcbtot, '$99,999,999.99') AS "Bidders Estimate",
                  TO_CHAR (SUM (q.qty * q.price), '$99,999,999.99')
                                                                   AS" Enginers Estimate"          
                
             FROM letprop l,
                  proposal p,
                  propitem q,
                  bidlet b,
                  bidtabs c,
                  itemlist i,
                  vendor v,
                  bidders d
            WHERE (l.letting = b.letting)
              AND b.letting = c.letting
              AND p.cspecyr = i.ispecyr
              AND q.prpitem = i.item
              AND p.contid = l.lcontid
              AND q.contid = p.contid
              AND c.vendor = l.avendor
              AND l.CALL = c.CALL
              AND q.lineflag = c.lineflag
              AND q.iplineno = c.iplineno
              AND l.letting = d.letting
              AND c.letting = l.letting
              AND c.CALL = d.CALL
              AND c.letting = d.letting
              AND v.vendor = d.vendor
              AND l.letstat = 'A'
              AND  b.datelet  between to_date ('2007/01/01', 'yyyy/mm/dd')    AND to_date ('2011/12/31', 'yyyy/mm/dd')
         GROUP BY v.vendor, v.vnames, d.calcbtot, (d.calcbtot / l.contamt), B.DATELET, d.call
         ORDER BY b.datelet, "Bidders Estimate";
Vendor Id     Vendor Name     Letting Date     Call Number     Bidders Estimate      Enginers Estimate
K0030              Interstate Improvement Inc     01/26/2007 00:00:00     009         $190,601.40         $209,895.00
M110               Mankato Electric Inc     01/26/2007 00:00:00     015         $216,790.00         $213,000.00
C470               Collisys     01/26/2007 00:00:00     015         $222,426.00         $213,000.00
K110               Killmer Electric Co Inc     01/26/2007 00:00:00     015         $223,386.00         $213,000.00
E110               Egan Company      01/26/2007 00:00:00     015         $225,740.00         $213,000.00
G0034              Granite Ledge Electrical Contractors Inc     01/26/2007 00:00:00     015         $226,750.00         $213,000.00
B500               Carl Bolander & Sons Co     01/26/2007 00:00:00     014         $227,227.00         $274,104.98
M0069              Mattison Contractors Inc     01/26/2007 00:00:00     014         $231,340.03         $274,104.98
T0041              Three Rivers Construction Inc     01/26/2007 00:00:00     014         $237,623.00         $274,104.98
M110               Mankato Electric Inc     01/26/2007 00:00:00     012         $238,971.20         $253,700.00
R290               Ridgedale Electric Inc     01/26/2007 00:00:00     015         $247,900.00         $213,000.00
desired out put is this one.

K0030              Interstate Improvement Inc     01/26/2007 00:00:00     009         $190,601.40         $209,895.00
M110               Mankato Electric Inc     01/26/2007 00:00:00     015         $216,790.00         $213,000.00
B500               Carl Bolander & Sons Co     01/26/2007 00:00:00     014         $227,227.00         $274,104.98

Maybe this? I used the dense rank as if two bidders have bid even then both of them will be selected. If you just want one, replace it with row_number()

SELECT * FROM (
SELECT v.vendor "Vendor Id",
       INITCAP (v.vnames) "Vendor Name",
       B.DATELET "Letting Date",
       d.CALL "Call Number",
       TO_CHAR ( d.calcbtot, '$99,999,999.99') AS "Bidders Estimate",
       TO_CHAR ( SUM (q.qty * q.price), '$99,999,999.99')
         AS " Enginers Estimate",
       DENSE_RANK ()
       OVER (
         PARTITION BY v.vendor,
                      v.vnames,
                      d.calcbtot,
                      (d.calcbtot / l.contamt),
                      B.DATELET,
                      d.CALL
         ORDER BY TO_CHAR ( d.calcbtot, '$99,999,999.99') ASC
       )
         RN
  FROM letprop l,
       proposal P,
       propitem q,
       bidlet b,
       bidtabs c,
       itemlist i,
       vendor v,
       bidders d
 WHERE (l.letting = b.letting)
   AND b.letting = c.letting
   AND P.cspecyr = i.ispecyr
   AND q.prpitem = i.item
   AND P.contid = l.lcontid
   AND q.contid = P.contid
   AND c.vendor = l.avendor
   AND l.CALL = c.CALL
   AND q.lineflag = c.lineflag
   AND q.iplineno = c.iplineno
   AND l.letting = d.letting
   AND c.letting = l.letting
   AND c.CALL = d.CALL
   AND c.letting = d.letting
   AND v.vendor = d.vendor
   AND l.letstat = 'A'
   AND b.datelet BETWEEN TO_DATE ( '2007/01/01', 'yyyy/mm/dd') AND TO_DATE ( '2011/12/31', 'yyyy/mm/dd')
GROUP BY v.vendor,
         v.vnames,
         d.calcbtot,
         (d.calcbtot / l.contamt),
         B.DATELET,
         d.CALL
ORDER BY b.datelet, "Bidders Estimate") where rn=1

G.

Tags: Database

Similar Questions

  • How to choose the record scontains 3 or more vowels/consonants?

    Hello

    I want to select records that contains 3, vowel or consonant letters and more. For example: AEI, SSTV, FGHATHER, EEEAR etc...

    I think I should use a regular expression, but I don't ' know how. I will be appreciated if you can send the right SQL.

    I also use 10g.

    Thank you

    Try this:

    WITH abc AS
         (SELECT 'aei' a
            FROM DUAL
          UNION ALL
          SELECT 'fgherwer' a
            FROM DUAL
          UNION ALL
          SELECT 'fgaafg' a
            FROM DUAL)
    SELECT a
      FROM abc
      WHERE REGEXP_INSTR(a, '[a|e|i|o|u]{3}') > 0 OR  REGEXP_INSTR(a, '[^a|e|i|o|u]{3}') > 0 
    

    Search string are case-senstive make sure your value in the column is lowercase if you use the expression as it is.

    concerning
    AJ

    Published by: AJ99 on June 25, 2009 12:08

  • How to choose the value of a string are numeric together and words of letters (for example, TEST)

    Hi all

    How to choose the value of a string are letters (for example, TEST) and all numeric...

    for example
    TEST 123456
    TEST 34567
    123456 ABCD
    1234 TEST
    TESTING 12345
    TEST 1@234$
    YOUR T 123456

    I want the results of the query as below.
    TEST 123456
    TEST 34567

    And I tried to use regexp_like in this case but without success. See the code below.
    SELECT * FROM TABLE WHERE regexp_like (Description, ' [TEST] % & [[: digit:]] + $');

    How can I do this, please answer.

    Thank you

    WF

    If you want to return only the rows that contain the string 'TEST', followed by zero or more space characters, followed by one or more digits?

    How about this:

    SELECT *.

    FROM my_table

    WHERE REGEXP_LIKE(description,'^TEST\s*\d+$')

  • How to choose the textfield values form and calculate

    Treat all

    Urgent please help

    How to choose the textfield values form and calculate totals. IE when clint fill amount textfield other textfields automatically calculate and display values. I am using uninstall.

    Thanks in advance

    My code is more

    < ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""

    " < html xmlns =" http://www.w3.org/1999/xhtml ">

    < head >

    < meta http-equiv = "Content-Type" content = text/html"; charset = utf-8 "/ >"

    < title > Untitled Document < /title >

    < / head >

    < body >

    < table width = "400" border = "0" align = "center" cellpadding = "0" cellspacing = "0" >

    < tr >

    < td width = "187" align = "right" valign = "middle" class = "KT_th" > < strong >

    < label for = "amount_gbp" > total (GBP): < / label >

    < / strong > < table >

    < td width = "14" height = "30" > < table >

    < td width = "199" height = "30" > < label >

    < input type = "text" name = "textfield" id = "textfield" / >

    < / label > < table >

    < /tr >

    < tr >

    < td align = "right" valign = "middle" class = "KT_th" > < strong >

    < label for = "admin_char_gbp" > Admin amount (GBP): < / label >

    < / strong > < table >

    < height td = "30" > < table >

    < height td = "30" > < label >

    < input type = "text" name = "textfield3" id = "textfield3" / >

    < / label > < table >

    < /tr >

    < tr >

    < td align = "right" valign = "middle" class = "KT_th" > < strong >

    < label for = "agent_char_gbp" > Agent Charges (GBP): < / label >

    < / strong > < table >

    < height td = "30" > < table >

    < height td = "30" > < label >

    < input type = "text" name = "textfield4" id = "textfield4" / >

    < / label > < table >

    < /tr >

    < tr >

    < td align = "right" valign = "middle" class = "KT_th" > < strong >

    < label for = "total_amount_gbp" > amount Total (GBP): < / label >

    < / strong > < table >

    < height td = "30" > < table >

    < height td = "30" > < label >

    < input type = "text" name = "textfield6" id = "textfield6" / >

    < / label > < table >

    < /tr >

    < tr >

    < td align = "right" valign = "middle" class = "KT_th" > < strong >

    < label for = "total_paid_gbp" > Total paid (GBP): < / label >

    < / strong > < table >

    < height td = "30" > < table >

    < height td = "30" > < label >

    < input type = "text" name = "textfield7" id = "textfield7" / >

    < / label > < table >

    < /tr >

    < tr >

    < td align = "right" valign = "middle" class = "KT_th" > < strong >

    < label for = "balance_gbp" > balance (GBP): < / label >

    < / strong > < table >

    < height td = "30" > < table >

    < height td = "30" > < label >

    < input type = "text" name = "textfield8" id = "textfield8" / >

    < / label > < table >

    < /tr >

    < /table >

    < / body >

    < / html >

    Here´s a pointer which will show you how to set the calculation within a javascript function: dynamically calculate the sum of the fields

    See you soon,.

    Günter

  • How to choose the display by default when you use two screens on my Mac Pro?

    How to choose the display by default when you use two screens on my Mac Pro?

    The default view when you have several is made that you drag the little icon in the menu bar in this pane:

    .

  • When you export (share) a project, how to choose the thumbnail of the freeze frame which restores the clip?

    I just shared (exported) a project that is a simple take a clip for a friend who has downloaded on its website. The problem is that, when the video ends by playing on his site, he returned to a freeze frame that seems completely random and is not the image I want. How to choose the exact image that the video will return as "thumbnail by default?"

    Thank you

    Kevin

    Cannot set lla at the FCC. Many layout site Web apps will allow you to set the poster frame for the video files.

  • How to choose the download location? download automatically to the users in c drive folder. I want to change it... Please help me...

    How to choose the download location? download automatically to the users in c drive folder... I want to change my office... Please help me out...

    Tools-> Options-> save-> click on the Browse button and find the folder where you want to save the files.

  • HP pavilion 15-e034tx: how to choose the right RAM for laptop

    How to choose the right RAM for my laptop (Pavilion 15-e034tx). I know I should buy DDR3 ram.

    Are there other factors should I consider when buying one? I got 2 slots for ram, which od these combos are possible?

    1-4 + 4 GB
    2-4 GB + 8 GB
    3-8 GB + 8 GB

    Thank you

    From the Manual:

    Two customer accessible/upgradable memory module slots

    Support for dual channel DDR3L (1600 MHz)

    Support 8192 MB RAM system in the following configurations:

    8192 MB (8192 MB × 1, × 4096 MB 2)

    Manual download link

    See page 53 for instructions. Memory access is easy via the service Panel. This is the part number for the approved 4 HP concert module:

    4 GB (PC3L, 12800, 1600 MHz) 691740-001

    http://www.Amazon.com/HP-691740-001-4GB-1600MHz-PC3L-12800/DP/B00CI08FX4/ref=sr_1_2?ie=UTF8 & qid = 1451655870 & SR = 8-2 & Keywords = 691740-001

    A 8 GB module is listed in the manual, and it's a 3rd generation of processor i5 I suspect 2 x 8 = 16 concerts would work, but strictly following the manual your only option is to add a 4 GB for a total of 8. Most users really not more 8 GB and adding a second identical module will allow two-channel operation, so you should see a noticeable jump in the overall performance.

    If it's 'the Answer' please click on 'Accept as Solution' to help others find it.

  • 4540 proBook s: how to choose the right network driver

    Hello guys. I clean installed Windows 7 Professional. Now, I see that I can not connect my computer to the internet, so I need to install the network drivers. I wen to the HP website and saw that there are 19 different network for my laptop drivers.
    How to choose the right method?

    Hello:

    Below are the links to the ethernet and wireless drivers you need...

    Wireless:

    This package contains the installation package driver for Ralink wireless LAN controllers in the laptop models running a supported operating system.

    File name: sp66089.exe

    This card also needs a bluetooth driver...

    This package contains the OS driver installation package for the Ralink Bluetooth in laptop computers running taken in charge.

    File name: sp59632.exe

    Ethernet:

    This package provides the driver for the Ethernet Realtek controller in the laptop models running a supported operating system.

    File name: sp63213.exe

  • How to choose the slot one of the two bunk?

    How to choose the slot one of the two bunk?

    Select the two points to cross the selection with the open selection tool, and then clear the high point on the page by holding shift and clicking on it.

    or vice versa. Select the high point of the page first and then select now shift. the high point of the page désélectionnera.

  • How to choose the language of the application

    Hello, how to choose the language of the application, I have is Russian, and I want an English version?

    Hello

    Welcome to Adobe Community.

    If you need to install the product in a different language, you can simply launch Creative Cloud Desktop and click on the settings tab in the upper right. On the settings tab, you will find the possibility to click on applications. Once we navigate to apps, you can change the language there.

  • How to choose the scheme of work of a different database instead of the database target

    Hi everyone, can you please answer to my problem.

    Q1.is it is mandatory that the two target schema schema and work must present in a database.if not then How to choose the scheme of work of another data base instead of target database schema. Please suggest.

    __Description__

    My work, my work patterns in odi's in a database schema and target in a different database,
    Now I'm dataserver with identification of the target or credentials of scheme work information.
    Here's the problem.

    I can't see scheme of work in the drop-down list when you create the physical schema with data server with the credentials of the target.

    It's obvious that he cannot show the workschema which presents in an another database.because - database server has the schema of the target database credentials.

    Vice versa

    Please suggest

    Concerning
    Chantal

    Hello

    Your KM will create the tables for working in the schema, you write to and that's why you have the problem:

    create table< %="odiRef.getTable" ("l",="" "int_name",="" "w")="" %="">

    I don't know of an option to replace this 'W' that will say 'go and get work in the staging area, I've specified.

    I guess that you can customize the KM and pass all the commands to Execute on the Source tab, or I guess you could specify the schema for each of the steps to be the logic diagram of the various staging areas.

    BUT I don't know if it would work throughout and I think it will create a massive Mount of work unnecessarily.

    Is there a decent reason why you can not have the staging area on the target?

  • FOR ADMINS - how to choose the right answer on a thread on this forum?

    FOR ADMINS - how to choose the right answer on a thread on this forum?

    For example, on:

    "missing plug-in" for safari after you download!

    http://forums.Adobe.com/thread/897677?TSTART=0

    It does not show on 5.1 Safari and Firefox on Mac OS X 10.6.8 6.0.2.

    Thank you!

    The normal user (non-admin type), which can mark a reply as useful or appropriate is the user who started the discussion.

  • LOBs and how to retrieve the record inserted with EMPTY_BLOb()

    Hi guys


    How to retrieve the records inserted with EMPTY_BLOb() instead of NULL value.


    Best greetings
    A.G.

    There must be a better way, but these work:

    SELECT... from tableX where length (lob_column) = 0;
    SELECT... from tableX where dbms_lob.getlength (lob_column) = 0;

    Concerning
    Jonathan Lewis
    http://jonathanlewis.WordPress.com
    http://www.jlcomp.demon.co.UK

    "All experts it is a equal and opposite expert."
    Clarke

  • How to choose the item value list based on another value of list item

    Hello friends,
    I have two list items named xxx and yyy... OK, my problem is I want to choose a value of yyy list item based on the value of article xxx...

    Example: I select 'Computer' in xxx... Based on this I want to choose the item values in yyy as a monitor, keyboard, mouse, etc... This must be done at run time. How can I do this... Give me a few examples of code [pls tell me trigger appropriate to place this encodings]
    Thanks in advance,
    Battistelli

    Very simple to use the LOV and query of the lov which is attached to the YYY field, use the query as below...

    SELECT columns
    FROM table
    WHERE column_name = :XXX_FIELD
    

    Use the ENTER OF LIST Yes property for the YYY field.

    -Clément

Maybe you are looking for