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. query not working correctly

query not working correctly

Scheduled Pinned Locked Moved Database
helpdatabase
4 Posts 3 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.
  • M Offline
    M Offline
    Mathew P V
    wrote on last edited by
    #1

    i have to display leave allotted record of a single employee in gridview but because i have stored three records of permanent employee in generalinfo table its displaying three times my query is as follows SELECT LeaveMaster.LeaveType, LeaveAllotted.NoOfDays FROM LeaveMaster INNER JOIN LeaveAllotted ON LeaveMaster.LeaveTypeID = LeaveAllotted.LeaveTypeID INNER JOIN EmpCategType ON LeaveAllotted.EmpCategID = EmpCategType.EmpCategID INNER JOIN GeneralInfo ON EmpCategType.EmpCategID = GeneralInfo.EmpCategID what should i do to rectify this problem a help from somebody will be deeply appreciated.

    S 1 Reply Last reply
    0
    • M Mathew P V

      i have to display leave allotted record of a single employee in gridview but because i have stored three records of permanent employee in generalinfo table its displaying three times my query is as follows SELECT LeaveMaster.LeaveType, LeaveAllotted.NoOfDays FROM LeaveMaster INNER JOIN LeaveAllotted ON LeaveMaster.LeaveTypeID = LeaveAllotted.LeaveTypeID INNER JOIN EmpCategType ON LeaveAllotted.EmpCategID = EmpCategType.EmpCategID INNER JOIN GeneralInfo ON EmpCategType.EmpCategID = GeneralInfo.EmpCategID what should i do to rectify this problem a help from somebody will be deeply appreciated.

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

      Have you tried the distinct keyword ? SELECT distinct LeaveMaster.LeaveType, LeaveAllotted.NoOfDays FROM LeaveMaster INNER JOIN LeaveAllotted ON LeaveMaster.LeaveTypeID = LeaveAllotted.LeaveTypeID INNER JOIN EmpCategType ON LeaveAllotted.EmpCategID = EmpCategType.EmpCategID INNER JOIN GeneralInfo ON EmpCategType.EmpCategID = GeneralInfo.EmpCategID

      _____________________________ Those who study history are doomed to watch others repeat it. -Scott M.

      M N 2 Replies Last reply
      0
      • S smcnulty2000

        Have you tried the distinct keyword ? SELECT distinct LeaveMaster.LeaveType, LeaveAllotted.NoOfDays FROM LeaveMaster INNER JOIN LeaveAllotted ON LeaveMaster.LeaveTypeID = LeaveAllotted.LeaveTypeID INNER JOIN EmpCategType ON LeaveAllotted.EmpCategID = EmpCategType.EmpCategID INNER JOIN GeneralInfo ON EmpCategType.EmpCategID = GeneralInfo.EmpCategID

        _____________________________ Those who study history are doomed to watch others repeat it. -Scott M.

        M Offline
        M Offline
        Mathew P V
        wrote on last edited by
        #3

        Thank you smcnulty i forgot to do that now its working once again thankyou very much

        1 Reply Last reply
        0
        • S smcnulty2000

          Have you tried the distinct keyword ? SELECT distinct LeaveMaster.LeaveType, LeaveAllotted.NoOfDays FROM LeaveMaster INNER JOIN LeaveAllotted ON LeaveMaster.LeaveTypeID = LeaveAllotted.LeaveTypeID INNER JOIN EmpCategType ON LeaveAllotted.EmpCategID = EmpCategType.EmpCategID INNER JOIN GeneralInfo ON EmpCategType.EmpCategID = GeneralInfo.EmpCategID

          _____________________________ Those who study history are doomed to watch others repeat it. -Scott M.

          N Offline
          N Offline
          Niladri_Biswas
          wrote on last edited by
          #4

          Yes I fully agree with Scott M Use distinct clause :)

          Niladri Biswas

          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