473,769 Members | 6,926 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(InfogadVec ka)

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 tblArtikelNrKun dKanal WHERE KundKanalID=" &
KundKanalIdx & ")"

' Runtime error
strSQL3 = "SELECT ArtikelNr, SUM(Förrådssald o) AS FSaldo, SUM(Förrådsvärd e)
AS FVarde, InfogadVecka" & _
" FROM tblData WHERE Artikelnr IN " & _
"(SELECT ArtikelNr FROM tblArtikelNrKun dKanal WHERE KundKanalID=" &
KundKanalIdx & ")" & _
" GROUP BY InfogadVecka"

--

Mvh
Jon

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

strSQL3 = "SELECT SUM(Förrådssald o) AS FSaldo, SUM(Förrådsvärd e)
AS FVarde, InfogadVecka" & _
" FROM tblData WHERE Artikelnr IN " & _
"(SELECT ArtikelNr FROM tblArtikelNrKun dKanal WHERE KundKanalID=" &
KundKanalIdx & ")" & _
" GROUP BY InfogadVecka"
"Jon" <jr*@telia.co m> wrote in message
news:Le******** ************@ne wsc.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(InfogadVec ka)

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 tblArtikelNrKun dKanal WHERE KundKanalID=" &
KundKanalIdx & ")"

' Runtime error
strSQL3 = "SELECT ArtikelNr, SUM(Förrådssald o) AS FSaldo, SUM(Förrådsvärd e) AS FVarde, InfogadVecka" & _
" FROM tblData WHERE Artikelnr IN " & _
"(SELECT ArtikelNr FROM tblArtikelNrKun dKanal 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
3596
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 very early draft for a new "assert" syntax: This was inspired in Ruby's assert syntax. I'm not familiar with Ruby at all, so the chances are that this piece of code is broken, but I think the idea is very obvious. In Ruby, assert is simply a...
4
15960
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. The while statement is as follows. while(infile.peek() != EOF) { infile.getline(temp1, max); };
3
1740
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 write an if statement so that if: 1. The word "Month" is in the validFromMonth field (where they haven't selected a month a the drop-down menu) or the word "Year" is in the validFromYear field (where they haven't selected a year another the...
3
4611
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 Access 97 (I know it's old. But, it's the tool they give me to work with) My working knowledge of SQL is on the low side. My working knowledge of VBA is beginner.
10
4294
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
3249
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. int variable;
6
2690
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 person wants to receive a newsletter and 0 no, don't want to receive it. Now.....when trying to create an UPDATE statement I am running into problems writing the code for it. I had issues before with missing commas but now that the commas are there...
2
7666
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 statement I wanted to wrap all the case statements in one try catch statement. However I am having problems doing this as there is a compilation error wrapping all the case statements inside the try block or putting the whole switch statement in the...
14
3104
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 INNER JOIN tblGC ON tblContacts.GCID = tblGC.gcID WHERE (((tblContacts.GCID)=strGCID))" i am just not sure of the proper syntax.
0
1598
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 trying to get the data on a form to save the data in the current table where it is stored, insert the data into 2 new tables all on a click event. I have got the first 2 tables to update fine but the third I am having difficulty with. The third...
0
10214
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10048
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3963
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.