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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. select where only

select where only

Scheduled Pinned Locked Moved Database
tutorial
3 Posts 2 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.
  • F Offline
    F Offline
    foryou
    wrote on last edited by
    #1

    Hi! I have a table Validation: Id_student --- - id_semestre ----- id_validation 102----------- - 1 ---------------- 4 102----------- - 1 ---------------- 3 -- 102----------- - 2 ---------------- 4 103----------- - 1 ---------------- 4 104----------- - 2 ---------------- 3 104----------- - 2 ---------------- 4 I want to select students who have in semestre 2 id_validation = 4 only . in the example i want have : 102 students, not 102 and 104 thank you.

    S 1 Reply Last reply
    0
    • F foryou

      Hi! I have a table Validation: Id_student --- - id_semestre ----- id_validation 102----------- - 1 ---------------- 4 102----------- - 1 ---------------- 3 -- 102----------- - 2 ---------------- 4 103----------- - 1 ---------------- 4 104----------- - 2 ---------------- 3 104----------- - 2 ---------------- 4 I want to select students who have in semestre 2 id_validation = 4 only . in the example i want have : 102 students, not 102 and 104 thank you.

      S Offline
      S Offline
      scottgp
      wrote on last edited by
      #2

      This works (using a correlated subquery), but I'm sure it's not the only way to get the correct results: select v1.id_student from validation v1 where v1.id_semestre = 2 and v1.id_validation=4 and not exists (select id_student from validation v2 where id_semestre = 2 and id_validation<>4 and V1.ID_STUDENT = V2.ID_STUDENT ) Scott

      F 1 Reply Last reply
      0
      • S scottgp

        This works (using a correlated subquery), but I'm sure it's not the only way to get the correct results: select v1.id_student from validation v1 where v1.id_semestre = 2 and v1.id_validation=4 and not exists (select id_student from validation v2 where id_semestre = 2 and id_validation<>4 and V1.ID_STUDENT = V2.ID_STUDENT ) Scott

        F Offline
        F Offline
        foryou
        wrote on last edited by
        #3

        Thanks scottgp it works.:)

        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