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

must I use 2 queries

Not having access to any mysql NG, I try to post here:

I've a query where I'd like to get the different values, but also a max for
2 fields:

SELECT max(CounterLogResult) as maxlog, max(CounterClick) as maxclick,
articleid, articlename...

but I get the errro:
Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is
illegal if there is no GROUP BY clause

I don't understand what I've to group....
Jul 17 '05 #1
5 3300
*** Bob Bedford escribió/wrote (Mon, 21 Mar 2005 19:55:39 +0100):
SELECT max(CounterLogResult) as maxlog, max(CounterClick) as maxclick,
articleid, articlename...

but I get the errro:
Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is
illegal if there is no GROUP BY clause


maxlog and maxclick are escalar values while articleid and articlename are
probably arrays (i.e., more than one row). You cannot mix them. I may be
wrong but you'd need two separate queries.

--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ No envíes tu dudas a mi correo, publícalas en el grupo
-+ Do not send me your questions, post them to the group
--
Jul 17 '05 #2
be******@notforspammershotmail.com says...
I've a query where I'd like to get the different values, but also a max for
2 fields:

SELECT max(CounterLogResult) as maxlog, max(CounterClick) as maxclick,
articleid, articlename...

but I get the errro:
Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is
illegal if there is no GROUP BY clause

I don't understand what I've to group....


SELECT max(CounterLogResult) as maxlog, max(CounterClick) as maxclick,
articleid, articlename...
GROUP BY articleid, articlename...

Group by all selected columns that are NOT aggregated values.

Geoff M
Jul 17 '05 #3
>> I've a query where I'd like to get the different values, but also a max
for
2 fields:

SELECT max(CounterLogResult) as maxlog, max(CounterClick) as maxclick,
articleid, articlename...

but I get the errro:
Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns
is
illegal if there is no GROUP BY clause

I don't understand what I've to group....


SELECT max(CounterLogResult) as maxlog, max(CounterClick) as maxclick,
articleid, articlename...
GROUP BY articleid, articlename...


Thanks for replying.

About speed consideration: it's is faster to group or to execute 2 queries ?
Jul 17 '05 #4
@notforspammershotmail.com says...
SELECT max(CounterLogResult) as maxlog, max(CounterClick) as maxclick,
articleid, articlename...
GROUP BY articleid, articlename...


About speed consideration: it's is faster to group or to execute 2 queries ?


Too many variables (which columns are indexed, etc.) for a definitive
answer, but generally one group by preferred over two queries.

Geoff M
Jul 17 '05 #5
*** Bob Bedford escribió/wrote (Wed, 23 Mar 2005 08:14:33 +0100):
About speed consideration: it's is faster to group or to execute 2 queries ?


The speed of queries mainly depends on complexity and number of returned
rows.

In your case you need two escalar values, there's no need to make data grow
adding this to a full row collection:

x x

+

x x x x x
x x x x x
x x x x x
x x x x x
x x x x x
....

vs.

x x x x x x x
- - x x x x x
- - x x x x x
- - x x x x x
- - x x x x x

--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ No envíes tu dudas a mi correo, publícalas en el grupo
-+ Do not send me your questions, post them to the group
--
Jul 17 '05 #6

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

Similar topics

22
by: David Sterling | last post by:
After much futzing about with the XML/XSD for the Search.Response, I had to resort to this... PLEASE Tell me there is a better way! private void ExecuteAQuery(string strLookingForWhat) {...
1
by: Roger Green | last post by:
I have inherited a complex database that has many dozens of queries that derive data from a people table. I now need to be able to run these queries (from within a significant number of forms)...
6
by: ano1optimist | last post by:
I have been running these queries in Access 2000 with no problems. This week, I had to install Access 2003 to create some runtime versions for another application, and now I keep getting "operation...
5
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I...
12
by: Bill Moran | last post by:
Hey all. I've hit an SQL problem that I'm a bit mystified by. I have two different questions regarding this problem: why? and how do I work around it? The following query: SELECT GCP.id,...
27
by: Bob | last post by:
running access 2k; mdb w/ linked tables to another mdb (front/back-end); trying to run a query that updates a table FROM information from a crosstab query. I AM NOTT trying to update the...
5
by: sara | last post by:
I have reports that run from a form where the user can choose a date range, or they run automatically for a week in the "Weekly Reports" option. I created 2 queries and 2 reports - one query...
20
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I...
1
by: CatchSandeepVaid | last post by:
I have posted this question in hibernate forums also.. As this forum is related to java, i am posting it here also ... In hibernate, presently one-to-one associations are fetched non-lazily... I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.