Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Help with Query

Help with Query

From: Ramon E. Estevez <com.banilejas_at_codetel.net.do>
Date: Mon, 02 Dec 2002 12:09:29 -0800
Message-ID: <F001.00510184.20021202120929@fatcity.com>

 

Hi list I need some help with a query. I have 3 tables ORIGINALES, CAMBIOS_ORIGINALES, DATOS_FABRICANTES, I have to be able to query an article for whatever code the user
provide, ex: (NUMERO_ORIGINAL, CAMBIO_ORIGINAL, NUMERO_FABRICANTE). The 3 tables
have a common column, NUMERO_ORIGINAL.  

When he type a code, no matter which one, I have to display the NUMERO_ORIGINAL,
CAMBIO_ORIGINAL(s), NUMERO_FABRICANTE(s) and the DESCRIPTION of the article. I merged
the 3 codes in the CODIGO_ARTICULO column to make the join for that column, but I can't get
the DESCRIPTION of the article.  

Any help would be appreciated,  

SQL> DESC ORIGINALES
 Name


 GRUPO                          
 COMPANIA                       
 NUMERO_ORIGINAL                
 NRO_DESCRIPCION                
 
SQL> DESC CAMBIOS_ORIGINALES
 Name                                   
 --------------------------------
 GRUPO                                  
 COMPANIA                               
 NUMERO_ORIGINAL                        
 CAMBIO_ORIGINAL                        
 SERIE                                  
 
SQL> DESC DATOS_FABRICANTES
 Name                                   
 ---------------------------------------
 GRUPO                                  
 COMPANIA                               
 NUMERO_ORIGINAL                        
 NUMERO_FABRICANTE                      
 LOCALIDAD                              
 
 ***********     This is what I came up with  ********************
 

CREATE OR REPLACE VIEW V_ARTICULOS AS
SELECT O.NUMERO_ORIGINAL CODIGO_ARTICULO,            O.NUMERO_ORIGINAL, D.DESCRIPCION, ' ' CAMBIO_ORIGINAL, ' ' NUMERO_FABRICANTE
     FROM ORIGINALES O, DESCRIPCIONES D
  WHERE
         D.NRO_DESCRIPCION = O.NRO_DESCRIPCION UNION
SELECT C.CAMBIO_ORIGINAL CODIGO_ARTICULO,            ' ', ' ', C.CAMBIO_ORIGINAL, ' ' NUMERO_FABRICANTE
     FROM CAMBIOS_ORIGINALES C
UNION
SELECT D.NUMERO_FABRICANTE CODIGO_ARTICULO,            ' ', ' ', ' ', D.NUMERO_FABRICANTE
     FROM DATOS_FABRICANTES D   /    

CODIGO_ARTICULO      NUMERO_ORIGINAL      DESCRIPCION
CAMBIO_ORIGINAL      NUMERO_FABRICANTE
-------------------- -------------------- ------------------------------
-------------------- --------------------
1                    1                    DESCRIPCION UNO
101-122519C1020      12251-PC1-020
101-122519C1020
101-12251PC1000      12251-PC1-020
101-12251PC1000
10A                  10A                  DESCRIPCION UNO
10AAAA               10A
10AAAA
10ABC                10A
10ABC
12251-PC1-020        12251-PC1-020        JUNTA DE CULATA
12345                12345                DESCRIPCION UNO
12345A               12345
12345A
12345AA              12345
12345AA
1414-TT-1414-BR      3
1414-TT-1414-BR
147                  147                  DESCRIPCION UNO
 
 
 

Ramon E. Estevez
com.banilejas_at_codetel.net.do
809-565-3121  

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Ramon E. Estevez
  INET: com.banilejas_at_codetel.net.do

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Dec 02 2002 - 14:09:29 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US