[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] SQL sum function in query tag?


To return the sum under the column name 'length' use 'AS', also, sku is a
string so needs to be quoted:

SELECT time_format(sum(length), '%T') AS length FROM music WHERE sku =
'[item-code]'

Thanks for all the help. The [sql pos 0] worked (with or without single quotes around sku), but not for everything.

Adding track times with MySQL's time_format doesn't work. I tested it at the command line, and it would add the seconds, say 242, and take the hundreds place (2), and add it to the minutes. If the seconds tens place were over 6, like 292, it would return NULL.

"AS length" did indeed change the column name.

So, I guess the only way to make it work would be manually, dividing by 60, etc.

Thanks again!

Josh

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.