0

I have a new problem right now, and I was wondering why its not displaying..

Scenario:

I have a duration where the duration is good only until 10:00....

In my database:

bldgName    duration

blgA         9:55
bldgA        9:40
bldgB        1:40

As we can see, my last row if I used the "DESC" its look like that... So my last entry in my bldgA is 9:55... I will add another 5s under bldgA and it will become 10:00, which is correct... So here's my database as for now..

Current database after adding the 5 seconds.

bldgName    duration

blgA         10:00
blgA         9:55
bldgA        9:40
bldgB        1:40

Here's my query:

$radio = mysql_query("SELECT fldBldgName, MAX(fldTotalDuration) as fldTotalDuration FROM tbldata WHERE fldNetname = '".$get_radio."' AND fldMonth = '".$get_month."' AND fldWeek = '".$get_week. "' GROUP BY fldBldgName ORDER BY id, fldBldgName, fldTotalDuration DESC");

So when the program read that query above...

the output is like this...

bldgName    duration

blgA         9:55
bldgB        1:40

This is wrong...

the correct output is

bldgName    duration

blgA         10:00
bldgB        1:40

And also, I don't have any filtering yet when the duration meets the 10:00

Thanks for advance...

4

2 回答 2

1

我想我明白他的意思。似乎您想获得最大持续时间,fldTotalDuration 是键入 varchar 吗?如果是,则最大值为 9:55 是正常的,因为该字段按字母顺序排序,我建议您将字段类型更改为十进制,它应该可以工作。

再见 Gnagno

于 2013-08-18T15:13:48.470 回答
0

我没有将其更改为INTDECIMAL,而是决定更改为TIME ...所以它现在已经可以使用了...

也感谢您的评论并提供一些想法,这对您有很大帮助..

于 2013-08-18T15:29:34.657 回答