473,387 Members | 1,541 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 expression problem

40
Hello,
I have written a query in access:

SELECT s.ID_SZKOLENIA, s.Nazwa_szkolenia, os.Data_rozpoczecia,
os.Data_zakonczenia, Count(*) AS Liczba_uczestnikow
FROM SZKOLENIA AS s, ODBYTE_SZKOLENIA AS os
WHERE os.ID_SZKOLENIA = s.ID_SZKOLENIA
GROUP BY os.ID_SZKOLENIA, os.Data_rozpoczecia;

but when I try to run it I get error msg: "You tried to execute that does not include the specified expression "ID_SZKOLENIA" as part of an aggregate function". What's wrong?

cheers
Jul 5 '07 #1
4 1295
MikeTheBike
639 Expert 512MB
Hello,
I have written a query in access:

SELECT s.ID_SZKOLENIA, s.Nazwa_szkolenia, os.Data_rozpoczecia,
os.Data_zakonczenia, Count(*) AS Liczba_uczestnikow
FROM SZKOLENIA AS s, ODBYTE_SZKOLENIA AS os
WHERE os.ID_SZKOLENIA = s.ID_SZKOLENIA
GROUP BY os.ID_SZKOLENIA, os.Data_rozpoczecia;

but when I try to run it I get error msg: "You tried to execute that does not include the specified expression "ID_SZKOLENIA" as part of an aggregate function". What's wrong?

cheers
Hi

As it says you havn't included the field in the Goup clause or an aggregate function. ie s.ID_SZKOLENIA (perhaps it should be os.ID_SZKOLENIA)


If the field(s) selected in the query is/are not in and aggregate function then they have to be in the Group clause

After you fix that one it will fail on the other field in the same situation ie. s.Nazwa_szkolenia

In addition I would select a field (and table) for the Count() function not Count(*)


HTH


MTB
Jul 5 '07 #2
saddist
40
Thank you :) It works now

Hi

As it says you havn't included the field in the Goup clause or an aggregate function. ie s.ID_SZKOLENIA (perhaps it should be os.ID_SZKOLENIA)


If the field(s) selected in the query is/are not in and aggregate function then they have to be in the Group clause

After you fix that one it will fail on the other field in the same situation ie. s.Nazwa_szkolenia

In addition I would select a field (and table) for the Count() function not Count(*)


HTH


MTB
Jul 5 '07 #3
NeoPa
32,556 Expert Mod 16PB
Nice work Mike :)
It's always nice to notice new helpers in the forum. Keep it up.
Jul 8 '07 #4
MikeTheBike
639 Expert 512MB
Nice work Mike :)
It's always nice to notice new helpers in the forum. Keep it up.
Thank you for the welcome.

I find it is always nice to help if you can.

MTB
Jul 12 '07 #5

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

Similar topics

23
by: Paul Rubin | last post by:
OK, I want to scan a file for lines matching a certain regexp. I'd like to use an assignment expression, like for line in file: if (g := re.match(pat, line)): croggle(g.group(1)) Since...
14
by: John Temples | last post by:
Given this code: extern volatile unsigned char v; int main(void) { v; return 0; }
5
by: JIM.H. | last post by:
Hello, I have this validation expression: ^(?:(?:0?|1)|(?:0?|11)(?!\/31)|(?:0?2)(?:(?!\/3|\/29\/(?:(?:0||)00|(?:\d{2}(?:0||))))))\/(?:0?||3)\/\d{4}$ This is supposed to match MM/DD/YYYY it is...
6
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the...
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
7
by: John Øllgård Jensen | last post by:
Hi Using MS Asccess 2000: In a query I'm trying to create a new field with following expression: FilmDate: Left(,4) The field "FilmNo" is another text field in the query. This is...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
1
by: Jan Limpens | last post by:
Hello, I am creating a simple CRUD application which uses xml files as data storage. I extended Textbox with a XPath expression and a XmlDocument property, this way I can easily read and update...
28
by: Marc Gravell | last post by:
In Linq, you can apparently get a meaningful body from and expression's .ToString(); random question - does anybody know if linq also includes a parser? It just seemed it might be a handy way to...
8
by: Stefano Sabatini | last post by:
Hi all, I'm encountering this while trying to implement a factory singleton method to generate objects. The singleton has a static map which binds a static creation function defined in each...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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.