Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL : plz do somthing its urgent.

SQL : plz do somthing its urgent.

Scheduled Pinned Locked Moved Database
databasehelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dev_rfid
    wrote on last edited by
    #1

    hi plz help me to solve my problem. i have two tables A and B A B ----------------------------------------------- SRNO STATUS SRNO STATUS ------------------------------------------------ 101 A 101 X 102 NULL 102 Y 103 NULL 103 Z 104 B 104 W ------------------------------------------------ I M TRYING FOR A QUERY FOR THE FOLLOWING OUTPUT : -------------------- SRNO STATUS ------------------- 101 A 102 Y 103 Z 104 B ----------------- THANKS :-):rose: -- modified at 10:01 Monday 13th February, 2006

    C 1 Reply Last reply
    0
    • D dev_rfid

      hi plz help me to solve my problem. i have two tables A and B A B ----------------------------------------------- SRNO STATUS SRNO STATUS ------------------------------------------------ 101 A 101 X 102 NULL 102 Y 103 NULL 103 Z 104 B 104 W ------------------------------------------------ I M TRYING FOR A QUERY FOR THE FOLLOWING OUTPUT : -------------------- SRNO STATUS ------------------- 101 A 102 Y 103 Z 104 B ----------------- THANKS :-):rose: -- modified at 10:01 Monday 13th February, 2006

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      SELECT A.SRNO, COALESCE(A.STATUS, B.STATUS)
      FROM A
      INNER JOIN B ON A.SRNO = B.SRNO

      COALESCE will return the first non-NULL from its parameters. ColinMackay.net "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius "If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell

      D 1 Reply Last reply
      0
      • C Colin Angus Mackay

        SELECT A.SRNO, COALESCE(A.STATUS, B.STATUS)
        FROM A
        INNER JOIN B ON A.SRNO = B.SRNO

        COALESCE will return the first non-NULL from its parameters. ColinMackay.net "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius "If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell

        D Offline
        D Offline
        Daniel Santillanes
        wrote on last edited by
        #3

        Cool, very clean and better than my possible suggestion (case when ...) daniero

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups