473,407 Members | 2,314 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,407 software developers and data experts.

problem with a querry

40
Hello,
TRAININGS(ID_TRAINING, TRAINING_NAME)
HOSTED_TRAININGS(ID_HOSTED_TRAINING, ID_TRAINING, DAYS)
EMPLOYEES_ON_TRAININGS(ID_HOSTED_TRAINING)

What I want to do is a querry with sum of days and number of employees for each training

Tried something like that but it returns error "ID_HOSTED_TRAINING is not a part of aggregate function" or something like that:/
Expand|Select|Wrap|Line Numbers
  1. SELECT s.TRAINING_NAME AS Szkolenia, Sum(ps.DAYS), (SELECT COUNT(*) FROM EMPLOYEES_ON_TRAININGS as pns WHERE pns.ID_HOSTED_TRAINING = ps.ID_HOSTED_TRAINING)
  2. FROM TRAININGS AS s, HOSTED_TRAININGS AS ps
  3. WHERE (s.ID_TRAINING = ps.ID_TRAINING)
  4. GROUP BY s.TRAINING_NAME
  5. ORDER BY s.TRAINING_NAME;
I also tried to write COUNT function without SELECT statemant but then it counts days wrong :/
Any ideas?
Aug 9 '07 #1
1 1214
Rabbit
12,516 Expert Mod 8TB
Use a join instead of a Where.
Aug 9 '07 #2

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

Similar topics

3
by: Bartosz Wegrzyn | last post by:
Please look at the code and if you can find my mistake. Please tell me why customerid is saved with wrong value the workorder table Instead of the correct value I get '0" When I try to...
4
by: Eric Kincl | last post by:
Hey everyone, I know this isn't a SQL group, but I'm on my colleges news server and they don't offer one. Hopefully someone here will be able to help me. I have a database that is normalized...
2
by: Eric Kincl | last post by:
Hello, I have an array of data in PHP. I would like to insert each member of the array into it's own row in SQL. The array is of variable length, so it would have to be dynamic code. How would...
0
by: Costa Lino | last post by:
Hi All, I have a DataSet with xml file and I want to make a querry like this DataView dv = new DataView(mytable); dv.RowFilter = " Impression < ( MaxImpressions) "; Impression et...
3
by: Piotr | last post by:
Hi, I have huge problem, as Access when executing querry (calculating values qty * price) shows the message "Not enough memory to remove changes" or something like this. How can I check what is...
5
by: Clownfish | last post by:
OK, I'm having a brain freeze. I have a table like this: Office Name Phone ---------------------------------- SG Larry 555-1212 SG Moe 553-4444 SG Curly ...
1
Steve Kiss
by: Steve Kiss | last post by:
Hi. I am developping a site for which one of the pages uses querry strings to pass some parameters. I can use the querry strings if I call the page from a plain html anchor. However, when I add the...
1
by: nj2md | last post by:
Can some one assist with a querry. I need to know the code to querry a database to find the number of female and males that make over 50K a year and how to get capital gains and loses from the same...
0
by: getmeidea | last post by:
I have the following tables, 1> employee_master(emp_id int primary key, emp_name varchar(100)); 2> employee_salary_payment(salary_rid int primary key, emp_id int, sal_date date, paid_amt int); ...
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
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.