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. problem in a tipical query(plzzz help me)

problem in a tipical query(plzzz help me)

Scheduled Pinned Locked Moved Database
helpdatabasequestion
5 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.
  • A Offline
    A Offline
    Arihant rathi
    wrote on last edited by
    #1

    hi this is ajay rathi, i am facing a very big problem, select month(Start_date) as start_Month, year(Start_date) as start_Year, sum(case when Status = 'Active' then 1 else 0 end) as Active, sum(case when Status = 'Inactive' then 1 else 0 end) as Billed from tbl_Post_Job where Company_Id_Fk = 60 and Start_date between Start_date and Exp_date group by year(Start_date), month(Start_date)order by year(Start_date), month(Start_date) in this query i want many things,first of all i want to say this is not right query i want query from you.. (1)month(Start_date) as start_Month, year(Start_date) as start_Year from this line i want month and year from Start_date to Exp_date (2)in active condition,if any company's status is active from january to april so in this condition the entry of active should be come in january to april in every month (3)group by year(Start_date), month(Start_date) in group by section same problem,i want data from Start_date to exp_date actually the main problem i m facing is this that when i need month and year together and active postion and billed position saperatlly.. actually i need this data in following form... Date | Active | Billed ------------------------------------ january,2007 | 4 | 2 feburary,2007 | 7 | 5 march,2007 | 4 | 2 april,2007 | 6 | 4 ------------------------------------ january,2007 is the start_date and april,2007 is the exp_date actualy above data january,2007 is coming in form of 1,2007 but i need this data in form of january,2007 so plz tell me how can i convert this data... plz if any one needs any clarification then plz ask me about this because i need this query immediatly.. plz try to help me as soon as posible

    Ajay Rathi software engineer NOIDA(UP),INDIA

    J 1 Reply Last reply
    0
    • A Arihant rathi

      hi this is ajay rathi, i am facing a very big problem, select month(Start_date) as start_Month, year(Start_date) as start_Year, sum(case when Status = 'Active' then 1 else 0 end) as Active, sum(case when Status = 'Inactive' then 1 else 0 end) as Billed from tbl_Post_Job where Company_Id_Fk = 60 and Start_date between Start_date and Exp_date group by year(Start_date), month(Start_date)order by year(Start_date), month(Start_date) in this query i want many things,first of all i want to say this is not right query i want query from you.. (1)month(Start_date) as start_Month, year(Start_date) as start_Year from this line i want month and year from Start_date to Exp_date (2)in active condition,if any company's status is active from january to april so in this condition the entry of active should be come in january to april in every month (3)group by year(Start_date), month(Start_date) in group by section same problem,i want data from Start_date to exp_date actually the main problem i m facing is this that when i need month and year together and active postion and billed position saperatlly.. actually i need this data in following form... Date | Active | Billed ------------------------------------ january,2007 | 4 | 2 feburary,2007 | 7 | 5 march,2007 | 4 | 2 april,2007 | 6 | 4 ------------------------------------ january,2007 is the start_date and april,2007 is the exp_date actualy above data january,2007 is coming in form of 1,2007 but i need this data in form of january,2007 so plz tell me how can i convert this data... plz if any one needs any clarification then plz ask me about this because i need this query immediatly.. plz try to help me as soon as posible

      Ajay Rathi software engineer NOIDA(UP),INDIA

      J Offline
      J Offline
      joemonvarghese
      wrote on last edited by
      #2

      hi Ajay Actually i didn't undestand your Qn... but using the below qry u will get the name of the month.. select datename(month,month(start_date)) from Regards Joe

      A 1 Reply Last reply
      0
      • J joemonvarghese

        hi Ajay Actually i didn't undestand your Qn... but using the below qry u will get the name of the month.. select datename(month,month(start_date)) from Regards Joe

        A Offline
        A Offline
        Arihant rathi
        wrote on last edited by
        #3

        you gave me solution of one problem "datename(month,month(start_date))" but this is giving me again and again only "january" nothing else.. so plz give me the other solution.. and wht you could not under stand in my first problem plz tell me.... i need the solution... plzzzzzzzz

        Ajay Rathi software engineer NOIDA(UP),INDIA

        P J 2 Replies Last reply
        0
        • A Arihant rathi

          you gave me solution of one problem "datename(month,month(start_date))" but this is giving me again and again only "january" nothing else.. so plz give me the other solution.. and wht you could not under stand in my first problem plz tell me.... i need the solution... plzzzzzzzz

          Ajay Rathi software engineer NOIDA(UP),INDIA

          P Offline
          P Offline
          pmarfleet
          wrote on last edited by
          #4

          Arihant rathi wrote:

          plzzzzzzzz

          Enough with the textspeak please. It's really annoying. If you want to get the year/month description, concatenate the result of datename(month,month(start_date)) and year(start_date).

          Paul Marfleet

          1 Reply Last reply
          0
          • A Arihant rathi

            you gave me solution of one problem "datename(month,month(start_date))" but this is giving me again and again only "january" nothing else.. so plz give me the other solution.. and wht you could not under stand in my first problem plz tell me.... i need the solution... plzzzzzzzz

            Ajay Rathi software engineer NOIDA(UP),INDIA

            J Offline
            J Offline
            joemonvarghese
            wrote on last edited by
            #5

            sorry for the wrong Qry correct one is select DATENAME(month, start_date) from

            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