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. get day wise records seperated by id

get day wise records seperated by id

Scheduled Pinned Locked Moved Database
databasedesign
3 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
    Member 10263519
    wrote on last edited by
    #1

    hi, am using query as Select machine_id as MachineID,item_name as Name,SUM(item_quantity) as Quantity,SUM(billed_amount) as BilledAmount,SUM(received_amount) as ReceivedAmount from transaction where DATE(paid_date)='" + rdate + "'Group by machine_id,item_name here rdate , am collecting from UI, string rdate = dateTimePicker1.Value.ToString("yyyy-MM-dd"); MachineID Name Quantity BilledAmount ReceivedAmount V0001 petrol 61 244 244 V0002 Diesel 186 726 726 V0002 petrol 155 605 605 Total 402 1575 1575 But i want for every machine id ,total row V0001 - - - - total - - - V0001 - - - - total - - -

    M B 2 Replies Last reply
    0
    • M Member 10263519

      hi, am using query as Select machine_id as MachineID,item_name as Name,SUM(item_quantity) as Quantity,SUM(billed_amount) as BilledAmount,SUM(received_amount) as ReceivedAmount from transaction where DATE(paid_date)='" + rdate + "'Group by machine_id,item_name here rdate , am collecting from UI, string rdate = dateTimePicker1.Value.ToString("yyyy-MM-dd"); MachineID Name Quantity BilledAmount ReceivedAmount V0001 petrol 61 244 244 V0002 Diesel 186 726 726 V0002 petrol 155 605 605 Total 402 1575 1575 But i want for every machine id ,total row V0001 - - - - total - - - V0001 - - - - total - - -

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      You are trying to make the database do the work of the UI, wrong tool for the job. You either need to use a reporting tool that will format the totals or do it yourself. This depends on your consumer. Good to see you asking a more sensible question. Do some research into parameterised queries and "Little Bobby Tables". One will make you life easier and the other may save you from disaster.

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      • M Member 10263519

        hi, am using query as Select machine_id as MachineID,item_name as Name,SUM(item_quantity) as Quantity,SUM(billed_amount) as BilledAmount,SUM(received_amount) as ReceivedAmount from transaction where DATE(paid_date)='" + rdate + "'Group by machine_id,item_name here rdate , am collecting from UI, string rdate = dateTimePicker1.Value.ToString("yyyy-MM-dd"); MachineID Name Quantity BilledAmount ReceivedAmount V0001 petrol 61 244 244 V0002 Diesel 186 726 726 V0002 petrol 155 605 605 Total 402 1575 1575 But i want for every machine id ,total row V0001 - - - - total - - - V0001 - - - - total - - -

        B Offline
        B Offline
        Bernhard Hiller
        wrote on last edited by
        #3

        Your GUI is written in C#, isn't it? So I'd suggest to do that extra calculation and formatting there.

        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