472,099 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,099 software developers and data experts.

db design or query

hi,
I am fairly newb to mysql, so excuse my silly question. I am working on a vbmysql application for a warehouse. Here I am importing an excel sheet to mysql which has weekly status of the products. I am storing it in the same table with date and product code and qty.
I want to display the weekly report and monthly report. Monthly report is easy but the problem is getting distinct values of rows as different columns for weekly report. i.e. I have stored dates, which I want to pick up distinct in different columns i.e.

qty where week(idate)=week(20080818)-4, qty where week(idate)=week(20080818)-3, ..... and so on.

I cant get it to work. I was wondering if there is a flaw in my db design, if so any suggestions how do I fix it? if not, then how do I get this query to work

thanks in advance,

regards,
Aug 21 '08 #1
1 1468
Atli
5,058 Expert 4TB
Hi.

Are you talking about something like:
Expand|Select|Wrap|Line Numbers
  1. SELECT WEEK(date_col) AS week, SUM(qty) 
  2. FROM dates GROUP BY week;
  3.  
Aug 22 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Test User | last post: by
5 posts views Thread by A_M_IS | last post: by
reply views Thread by YellowFin Announcements | last post: by
5 posts views Thread by rdemyan via AccessMonster.com | last post: by
2 posts views Thread by existential.philosophy | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.