Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002
    Posts
    19

    Unanswered: help with null in access

    l have two tables, emp and dept. Emp has a foreing key (DEPTNO) with table dept but it can be null.

    I want all register of emp with DEPTNO although DEPTNO is null in emp

    In Oracle I had:

    select * from emp, dept where emp.DEPTNO=dept.DEPTNO(+);

    does it exist in access?

    Thanks

  2. #2
    Join Date
    Feb 2003
    Posts
    24

    Re: help with null in access

    Originally posted by PILAR
    l have two tables, emp and dept. Emp has a foreing key (DEPTNO) with table dept but it can be null.

    I want all register of emp with DEPTNO although DEPTNO is null in emp

    In Oracle I had:

    select * from emp, dept where emp.DEPTNO=dept.DEPTNO(+);

    does it exist in access?

    Thanks
    SELECT * FROM emp LEFT OUTER JOIN dept ON emp.DEPTNO = dept.DEPTNO

  3. #3
    Join Date
    Nov 2002
    Posts
    19

    which is the better query?

    Thanks for answer. It has been very useful. I am new in Access.
    Now, I need know : which is the better query?

    query 1:
    SELECT [TXT_REMESA], FEC_CREACION], (SELECT COUNT(*) FROM EFECTO WHERE efecto.id_remesa = remesa.id_remesa) AS numDocumentos, (SELECT SUM(nen_importe) FROM EFECTO WHERE efecto.id_remesa = remesa.id_remesa) AS importeTotal
    FROM remesa
    ORDER BY [remesa].[TXT_REMESA];


    query 2:
    SELECT TXT_REMESA, remesa.FEC_CREACION, Count(efecto.ID_EFECTO) AS numDocumento, Sum(efecto.NEN_IMPORTE) AS SumaDeNEN_IMPORTE
    FROM remesa LEFT JOIN efecto ON remesa.ID_REMESA = efecto.ID_remesa
    GROUP BY remesa.TXT_REMESA, remesa.FEC_CREACION, remesa.TXT_ESTADO;

    In the first query I don´t use LEFT JOIN. is better to use it?


    Any help or guidance would be appreciated

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •