Jump to content

sql thathalu mamlu ravali


Recommended Posts

Posted
39 minutes ago, 4Vikram said:

naaku antha manchiga asthe bane unde,, nake oka samasya unadi nuvu chesta ante chepu chepta 

bodi ki tweet cheyyi help chestadu

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • nenu_devudni

    14

  • Bhai

    5

  • comradee

    4

  • 4Vikram

    3

Top Posters In This Topic

Posted
7 hours ago, Bhai said:

bodi ki tweet cheyyi help chestadu

E :) endi mei nee racha eeda

Posted
16 hours ago, nenu_devudni said:

ee with clause lo una query lo highlight chesina col's add chesa ... and where clause lo add chesina new table vala records join vala thakuva ostunay ..  joins try chesina work avatledu .. deni ela fix cheyalo teliste cheppandi vaya @~`

 

WITH cte AS
     (SELECT   ucbcust_cust_code cust_code, 
           REPLACE(ucbcust_last_name,'|','') last_name,
           REPLACE(ucbcust_status_ind,'|','') status_ind,
           ucbcust_start_date start_date,
           ucbcust_activity_date activity_date,
           REPLACE(ucbcust_first_name,'|','') first_name, 
           REPLACE(ucbcust_middle_name,'|','') middle_name,
           REPLACE(ucbcust_toto_ind,'|','') toto_ind,
           REPLACE(ucbcust_builder_type,'|','') builder_type,
           REPLACE(ucbcust_pay_by_check_ind,'|','') check_ind,
           ucbcust_end_date end_date,
           REPLACE(ucbcust_email_address,'|','') email_addr,
           REPLACE(ucbcust_primary_prem_code,'|','') pr_prem_code,
           UPPER (ucrtele_phone_area) tele_area, 
           UPPER (ucrtele_phone_number) tele_num,
           UPPER (ucrtele_phone_ext) tele_ext, 
           UPPER (ucrtele_tele_code) tele_code,
           UCRADDR_STREET_NUMBER, 
           UCRADDR_PDIR_CODE_PRE, 
           UCRADDR_STREET_NAME, 
           UCRADDR_SSFX_CODE, 
           UCRADDR_PDIR_CODE_POST, 
           UCRADDR_UTYP_CODE, 
           UCRADDR_UNIT, 
           UCRADDR_CITY, 
           UCRADDR_STAT_CODE, 
           UCRADDR_ZIP, 
           UCRADDR_SEQNO,

               ROW_NUMBER () OVER (PARTITION BY ucbcust_cust_code ORDER BY ucrtele_tele_code) as rnum
          FROM ucbcust, ucrtele, ucraddr a
         WHERE ucbcust_cust_code = ucrtele_cust_code(+)
           AND ucbcust_cust_code(+) = ucraddr_cust_code
           AND a.UCRADDR_SEQNO = (SELECT MIN(b.ucraddr_seqno) 
                                                           FROM ucraddr b 
                                   WHERE b.ucraddr_cust_code = ucbcust_cust_code 
                                     AND b.ucraddr_atyp_code = 'MA'
                                     AND b.ucraddr_status_ind = 'A')

      ORDER BY DECODE (ucrtele_tele_code, 'BU', 'AA', 'HM', 'AB', 'ZZ'))
    SELECT *
     FROM cte
    WHERE rnum = 1

asalu nev run chesava.. bcoz.. order by unte execute cheyanivaddu kada.CTE Lo......... order by column     SELECT *
     FROM cte
    WHERE rnum = 1 ORder by................... ekkada add cheyali..

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...