473,385 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

SQL code for returning this weeks salesdata

Hi,

Can anybody spot the error in my code please

Expand|Select|Wrap|Line Numbers
  1. SELECT HistoryLines.DDate, CustomerMaster.CustomerDesc, HistoryLines.Description, HistoryLines.Qty, HistoryLines.UnitPrice, HistoryLines.DiscountAmount
  2. FROM HistoryLines INNER JOIN CustomerMaster ON HistoryLines.CustomerCode = CustomerMaster.CustomerCode
  3. WHERE datepart("ww"[HistoryLines.DDate],2)=datepart("ww",[Date()],2);
  4.  
the error message is complaining of a missing operator within the WHERE clause. I am attempting to show sales data for this week only. I think the "2" will mean the week will start on a monday. The tables are linked to Pastel Accounting package - I am not sure if that makes a difference.

Thanks

Alex
Mar 31 '11 #1
1 1344
Hi,

I actually spotted them as soon as I posted. The correct code is given below.

Expand|Select|Wrap|Line Numbers
  1. SELECT HistoryLines.DDate, CustomerMaster.CustomerDesc, HistoryLines.Description, HistoryLines.Qty, HistoryLines.UnitPrice, HistoryLines.DiscountAmount
  2. FROM HistoryLines INNER JOIN CustomerMaster ON HistoryLines.CustomerCode = CustomerMaster.CustomerCode
  3. WHERE datepart("ww",[HistoryLines.DDate],2)=datepart("ww",Date(),2) AND Year( [HistoryLines.DDate]) = Year(Date())
  4. ORDER BY HistoryLines.DDate DESC;
  5.  
thank

Alex
Mar 31 '11 #2

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

Similar topics

12
by: Sims | last post by:
Hi, Here is the code that .NET does not seem to like, but as far as i can see it is valid C++ code. Am i wrong? .... // vector headers ....
5
by: Michael Hiegemann | last post by:
Hello, I am unaware whether this is the right group to ask. Please point me to another forum if required. I would like to replace a Fortran function by one which is written in C. The function...
2
by: Neil Aggarwal | last post by:
Hello: I am using gcc on RedHat Linux 9. When I try to do a reverse dns query using gethostbyaddr, it works fine for hosts that have a PTR record, but it returns null for hosts that have a...
2
by: Philippe F. Bertrand | last post by:
Summary - What should a C# bool map to in C++? Are return types different? I have lots of methods declared with bool parameters and bool return type which appear to work without any problems...
10
by: KeithRaginF | last post by:
Hello I am trying to return the contents of an Excel file. However, I don't want to just redirect the request to the Excel file since it does not reside in a location where that is appropriate. ...
1
by: Matthias De Ridder | last post by:
Hello, I really hope that someone will be able to help me, because I'm desperate now! I'm a student, graduating this year, and I'm working on a thesis where C# Web Services are involved. I...
3
by: maflatoun | last post by:
Hi, I must be losing my mind why is the following code returning wrong values? var d = new Date(); alert(d); -> Fri Apr 7 09:28:18 EDT 2006 alert("Hour:" + d.getHours()); -> 9...
2
by: jzogg7272 | last post by:
In my code I am executing a stored procedure to do a single row insert. I check the return value of the execution and I am getting -1, whereas a few weeks ago it was returning 0. Actually, I found...
9
by: pejy69 | last post by:
Hi My name is PJ and i'm an adult student who requires a pointer in the right direction. Below is a snippett of the code that i believe i have something wrong in but cant work out what i have done...
10
by: timleonard | last post by:
How can the following code to be modified to include a duration Column or "Named Range"? I would like to modify it so that a task that has a duration for example, three to five days would show...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.