实施例: $ from = 30和$ to = 33。 现在我希望得到$ from和$ to之间的总价。
这是我的代码。
$from = $_POST['from'];
$to = $_POST['to'];
$result = mysql_query("SELECT SUM(price) as totalPrice FROM price WHERE price BETWEEN '$from' and '$to'");
$row = mysql_fetch_assoc($result);
$sum = $row['totalPrice'];
答案 0 :(得分:2)
- (NSString *)displayName
{
NSMutableString *displayName = [NSMutableString stringWithString:[super displayName]];
if ([self fileURL] == nil) {
NSString *firstCharacter = [[displayName substringToIndex:1] lowercaseString];
[displayName deleteCharactersInRange:NSMakeRange(0, 1)];
[displayName insertString:firstCharacter atIndex:0];
}
return [NSString stringWithString:displayName];
}
答案 1 :(得分:0)
SELECT sum(`price`) as total FROM `table` where from = 30 AND `to` = 33
..可能会改变,或者依赖于你想要的东西。