Professional Web Applications Themes

sum in query not working. Help please..... - Macromedia ColdFusion

here is my query. the 3rd sum (totcost) does not ouput anything. i cant seem to figure it out. what am i doing wrong? <CFQUERY name='GetLegal' dataSource='limited'> SELECT materials.id, SUM(fabric_total) as totfabric, SUM(labor_price) as totlabor, SUM(labor_price+fabric_total)as totcost FROM materials, products WHERE products.id = #Variables.RecordID# and materials.id=products.id GROUP BY materials.id </CFQUERY>...

  1. #1

    Default sum in query not working. Help please.....

    here is my query. the 3rd sum (totcost) does not ouput anything. i cant seem
    to figure it out. what am i doing wrong? <CFQUERY name='GetLegal'
    dataSource='limited'> SELECT materials.id, SUM(fabric_total) as totfabric,
    SUM(labor_price) as totlabor, SUM(labor_price+fabric_total)as totcost FROM
    materials, products WHERE products.id = #Variables.RecordID# and
    materials.id=products.id GROUP BY materials.id </CFQUERY>

    Joe Science Guest

  2. #2

    Default Re: sum in query not working. Help please.....

    Hi Joe,

    What are the datatypes of labor_price and fabric_total? Depending on the
    database that you're using, it might not be able to do an implicit cast between
    types. For example, it cannot perform an addition between a string and a float
    without explictly casting the string to a float first.

    Also, have you tried sum(labor_price) + sum(fabric_total) as totcost?

    Ed

    Ed Ip Guest

Similar Threads

  1. Acces Query not working
    By rubeel in forum Coldfusion - Getting Started
    Replies: 7
    Last Post: September 9th, 11:59 PM
  2. PHP Update query not working
    By sharky92663 in forum Dreamweaver AppDev
    Replies: 1
    Last Post: May 6th, 02:06 AM
  3. Help me I have been working all day trying to get thisUpdate Query to work
    By murpg in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: April 28th, 03:52 AM
  4. Query not working
    By dkemens in forum Macromedia ColdFusion
    Replies: 28
    Last Post: April 15th, 06:13 PM
  5. recordset query not working
    By Don Pacino in forum Dreamweaver AppDev
    Replies: 5
    Last Post: April 2nd, 09:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139