Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sql query help....

    Anyone can help me?
    My data like this....

    absen table data
    id date
    1 2006-04-01
    2 2006-04-02
    3 2006-04-03
    1 2006-04-01
    2 2006-04-02
    1 2006-04-01
    2 2006-04-02
    3 2006-04-03

    pegawai table data
    id name
    1 John
    2 Miranda
    3 Michael

    I want to show pegawai.id where pegawai.id not in table absen on 2006-04-03 by sql code...
    i'm use this code, but not work

    Code:
    SELECT
    pegawai.id
    FROM
    pegawai,
    absen
    WHERE
    pegawai.id <> absen.id AND
    absen.date = '2006-04-03'
    it show like this
    id
    1
    2
    3
    3

    i want it show like this
    id
    3
    Edit/Delete Message
    Last edited by tawongunung; 04-17-2006 at 07:25 AM.

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    SELECT name FROM table1 WHERE id NOT IN (SELECT id FROM table2 WHERE date<>'2006:04:03');


  •  

    Posting Permissions

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