I'm trying to sum all numeric fields individually. I won't always know the field names, otherwise I could manually construct the query SELECT SUM(Field1) as Field1, SUM(Field2) as Field2...etc FROM myTable
Is there a way to construct this on the fly in mysql? I'm thinking there's probably a way to incorporate SELECT COLUMN_NAME FROM information_schema WHERE TABLE_NAME=myTableName AND DATA_TYPE IN('tinyint','decimal')
, but I'm not sure how. Thanks!
grant.baker 10 Newbie Poster
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
grant.baker 10 Newbie Poster
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
grant.baker 10 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.