Search the Community
Showing results for tags 'calculation'.
-
I'm trying to make a diesel consumption scoreboard for the drivers in our company, but not sure how I can sort the drivers by average fuel consumption. I have two database tables, one for the members and one for the fuel data. I'm using this sql query to calculate the average, but I would like to have some more information in the same query and also a way to easily sort the members by their average fuel consumption to complete the scoreboard. SELECT 10 * SUM(liter) / (MAX(km) - MIN(km)) as AvgFuel FROM diesel WHERE diesel.dato >= '$dx' AND userid = ".$_COOKIE['userid']."; In the diesel table there are information like km, liters, dates, locations etc. How can I extend this query to have more information instead of having multiple queries ? (I'm a newbie) Thanks for reading!
- 3 replies
-
- sql
- calculation
-
(and 1 more)
Tagged with:
-
Hello, Let me explain with an example. Lets say I have an Image of size 960px X 668px I have a div which holds this image. The div size is 154px X 75px This div can have any variable size. If we see that the aspect ratio of image and the aspect ratio of the div that holds image are different. All i need to do is Resize and Crop the Image in such a way that it takes maximum possible height and width of the original size and also maintain the aspect ratio of the div that holds this image. I just need a logic to calculate a percentage that by how much DIV width and height should be multiplied so that the resulting size is closer to the image size but doesnot exceed the image size and also the aspect Ratio will be same as that of DIV but not of image.. The motive to do this is that image exactly fits the div when scaled to div's size without stretching or disorting the image. Thanks watsmyname