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 satatment

Select satatment

Scheduled Pinned Locked Moved Database
databasetutorial
4 Posts 4 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.
  • W Offline
    W Offline
    wmostafaw
    wrote on last edited by
    #1

    Dear all, i have tow tables 'Users' and 'Applications' every user may be has no,one or more applications how to write a SQL satement that get me every user who hasn't application. in other word i want user without application... thanks.

    R C A 3 Replies Last reply
    0
    • W wmostafaw

      Dear all, i have tow tables 'Users' and 'Applications' every user may be has no,one or more applications how to write a SQL satement that get me every user who hasn't application. in other word i want user without application... thanks.

      R Offline
      R Offline
      rp_suman
      wrote on last edited by
      #2

      It would be helpful to answer if you state the field names, type and with which field both tables are connected. I think you have to do something like: select userId from user_table where (Application_table.applCnt = 0 and Application_table.userId = user_table.userId) if both tables are connected by userId. Thanks & Regards, Suman

      1 Reply Last reply
      0
      • W wmostafaw

        Dear all, i have tow tables 'Users' and 'Applications' every user may be has no,one or more applications how to write a SQL satement that get me every user who hasn't application. in other word i want user without application... thanks.

        C Offline
        C Offline
        Cristian Amarie
        wrote on last edited by
        #3

        select * from Users
        where not exists (
        select A.AppID from Applications A
        where A.AppID = Users.AppID
        )

        1 Reply Last reply
        0
        • W wmostafaw

          Dear all, i have tow tables 'Users' and 'Applications' every user may be has no,one or more applications how to write a SQL satement that get me every user who hasn't application. in other word i want user without application... thanks.

          A Offline
          A Offline
          albCode
          wrote on last edited by
          #4

          SELECT DISTINCT Users.IDApp FROM Users WHERE Users.IDApp NOT IN (SELECT Application.IDAp FROM Application)


          "My advice to you is to get married. If you find a good wife, you will be happy; if not, you will become a philosopher." Socrates

          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