![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Database Database problems or need to ask a question? maybe something to do with sql injections or a database software question. Database topics cover MySQL, PostgreSQL, Oracle, SQL Server or anything else related to databases. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hey all. I need to do a select and I didn't find how to do it yet. The structure of the table: table product_mov idmov idproduct date in out average Example of data in the order of fields. I'll put the product name into () to easier view. 1 - 2 (Memory) - 2007-06-10 - 10 - 0 - 10 2 - 2 (Memory) - 2007-06-11 - 0 - 5 - 5 3 - 3 (CPU) - 2007-06-11 - 20 - 0 - 20 4 - 2 (Memory) - 2007-06-12 - 13 - 0 - 18 5 - 3 (CPU) - 2007-06-15 - 0 - 3 - 17 What I have to do is to return the sum of the average of all products lower than a date. But I need to sum only the register immediately lower than the date of each product. So, if I want the average sum of the day 2007-06-16, I'll take the last memory and cpu registers and sum it. In this case the registers 4 and 5. My result will be 18+17 = 35. If I want of the day 2007-06-13, I'll take the registers 4 and 3 and sum it. 18+20 = 38 How can I do that? -- Kico Zaninetti carpe diem | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: distinct, problem, select, sum |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| select distinct | natalalaa@googlemail.com | Database | 7 | 07-01-2007 11:00 PM |
| Select Problem | amerar@iwc.net | Database | 0 | 07-01-2007 6:44 PM |
| problem with select count(*) | Ben | Database | 2 | 05-31-2007 8:49 PM |
| SELECT COUNT(*) problem | JB | Database | 3 | 05-31-2007 8:42 PM |
| SELECT DISTINCT with Joins? | Aapo V | Database | 1 | 05-31-2007 8:39 PM |
| Featured Websites | ||||
|