473,387 Members | 1,453 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,387 software developers and data experts.

SQL statement problems

Jon
Hi all
I know this is not the preferred newsgroup, but you people are great with
SQL
MS ACCESS, VISUAL BASIC6

Hope you can see past my table, string definitions (Swedish), just ask
otherwise

Having some problem with a SQL statement
I need to be able to run strSQL3, but I get an error about sum and that I
don't have ArtikelNr.
I need to GROUP the 2 sums by week(InfogadVecka)

Any help at all would be appreciated
'this works fine
strSQL2 = "SELECT ArtikelNr, Förrådssaldo, Förrådsvärde, InfogadVecka" & _
" FROM tblData WHERE Artikelnr IN " & _
"(SELECT ArtikelNr FROM tblArtikelNrKundKanal WHERE KundKanalID=" &
KundKanalIdx & ")"

' Runtime error
strSQL3 = "SELECT ArtikelNr, SUM(Förrådssaldo) AS FSaldo, SUM(Förrådsvärde)
AS FVarde, InfogadVecka" & _
" FROM tblData WHERE Artikelnr IN " & _
"(SELECT ArtikelNr FROM tblArtikelNrKundKanal WHERE KundKanalID=" &
KundKanalIdx & ")" & _
" GROUP BY InfogadVecka"

--

Mvh
Jon

jo*************@comhem.se
Nov 12 '05 #1
2 1298
Try this:

strSQL3 = "SELECT SUM(Förrådssaldo) AS FSaldo, SUM(Förrådsvärde)
AS FVarde, InfogadVecka" & _
" FROM tblData WHERE Artikelnr IN " & _
"(SELECT ArtikelNr FROM tblArtikelNrKundKanal WHERE KundKanalID=" &
KundKanalIdx & ")" & _
" GROUP BY InfogadVecka"
"Jon" <jr*@telia.com> wrote in message
news:Le********************@newsc.telia.net...
Hi all
I know this is not the preferred newsgroup, but you people are great with
SQL
MS ACCESS, VISUAL BASIC6

Hope you can see past my table, string definitions (Swedish), just ask
otherwise

Having some problem with a SQL statement
I need to be able to run strSQL3, but I get an error about sum and that I
don't have ArtikelNr.
I need to GROUP the 2 sums by week(InfogadVecka)

Any help at all would be appreciated
'this works fine
strSQL2 = "SELECT ArtikelNr, Förrådssaldo, Förrådsvärde, InfogadVecka" & _ " FROM tblData WHERE Artikelnr IN " & _
"(SELECT ArtikelNr FROM tblArtikelNrKundKanal WHERE KundKanalID=" &
KundKanalIdx & ")"

' Runtime error
strSQL3 = "SELECT ArtikelNr, SUM(Förrådssaldo) AS FSaldo, SUM(Förrådsvärde) AS FVarde, InfogadVecka" & _
" FROM tblData WHERE Artikelnr IN " & _
"(SELECT ArtikelNr FROM tblArtikelNrKundKanal WHERE KundKanalID=" &
KundKanalIdx & ")" & _
" GROUP BY InfogadVecka"

--

Mvh
Jon

jo*************@comhem.se

Nov 12 '05 #2
Jon
Hi MacDermott

Thanks for the help, works like a charm.

Regards
Jon
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Fábio Mendes | last post by:
I'm sorry if it's an replicate. Either my e-mail program is messing with things or the python-list sent my msg to /dev/null. I couldn't find anything related in previous PEP's, so here it goes a...
4
by: muser | last post by:
I have a logical error in my program, I have submitted the program and my tutor hasn't listed the other problems with the code, but said that the program won't run because of a while statement....
3
by: Mark Morton | last post by:
I'm writing an if statement for a UK credit card form validation script. Users who specify that their card is Switch need to enter either the issue number or the 'valid from' date. I'm trying to...
3
by: Andy_Khosravi | last post by:
I have been trying to build a user friendly search engine for a small database I have created. I'm having some particular problems with one of my date fields. Here's the setup: I'm using...
10
by: Maksim Sipos | last post by:
Hello, I would like to have something like #ifdef VERSION_DEBUG #define DEBUG(x) DebugFnc(x) #end #ifdef VERSION_RELEASE #define DEBUG(x) <empty-statement> #end
81
by: candy | last post by:
hi all, Is there is any way in the C language by which I can get the address of a statement? For eg,consider the following simple program: 1. #include<stdio.h> 2. 3. int main(void){ 4. ...
6
by: FayeC | last post by:
I really need help figuring this out. i have a db with mostly text fields but 2. The user_id field is an autonumber (key) and the user_newsletter is a number (1 and 0) field meaning 1 yes the ...
2
by: Macca | last post by:
Hi, I have a switch statement that has 5+ case statements. Each of these case statements copies form one array to another. Rather than doing a separate try..catch statement for each case...
14
by: Matt | last post by:
I need to add the following variable into an SQL statement and not sure how to do it. strGCID needs to be inserted into the following statement: SQL = "SELECT tblContacts.* FROM tblContacts...
0
BenRatcliffe
by: BenRatcliffe | last post by:
Hi there, I was wondering if anyone could help me. I have a comlpex database with a number of forms that have data entered on them and then saved into the correct table etc. In this instance I am...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.