Ask a Question related to Coldfusion Database Access, Design and Development.
-
glossen #1
2 table query problem
Im having trouble with this query. I have 2 tables. I only want to display
the events table but I want to sort the results based on the users average
rating on the article(events).
SELECT events.evSubject, events.evID, AVG(ev_rating.rating) AS "rating" FROM
events, ev_rating WHERE events.evType = 12 AND events.evPrivate = 0 AND
events.evStat = 3 AND ev_rating.rtID = events.evID ORDER BY rating
I get error: General error: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...)
with no GROUP columns is illegal if there is no GROUP BY clause
Im not a huge sql guru but I know most of you are. I wasnt sure how else to
do this or sort the list like I want.
glossen Guest
-
Alter table query problem
Need a little newbie help with altering a table in mysql. I created a varchar(255) column that is no longer suitable for my needs and I wan to... -
Query w/bad table structure
Hi, I am trying to query a column that has multiple values. When I export it, I need to have it so that each of those values is placed in its own... -
ASP / Access: use of same table twice in one query
Hi, In a query I use the same table twice: Select u.*, ud.*, dep.*, u2.* from users as u, departments as dep, user_in_departments as ud, users... -
Mulitple Table Query Help
I'm not sure the follow multiple table query is the right way to do what I need to do although it seems to be working: $php_SQL = "SELECT * ".... -
Temporary Table Query
Hi, I am inserting data into a temporary table using the following method: select a into #b from c This method works fine, but...if i... -
paross1 #2
Re: 2 table query problem
Like the error message said, since you are performing an aggregate function
without a GROUP BY.
SELECT events.evSubject, events.evID, AVG(ev_rating.rating) AS "rating"
FROM events, ev_rating
WHERE events.evType = 12
AND events.evPrivate = 0
AND events.evStat = 3
AND ev_rating.rtID = events.evID
GROUP BY events.evSubject, events.evID
ORDER BY rating
Phil
paross1 Guest
-
glossen #3
Re: 2 table query problem
Thanks Phil. Im having an issue with that query. It wasnt sorting by the
average rating for that record. That table(events) only has 5 records right
now. But each event has many ratings (hence the AVR). I put that query in and
the results were as follows:
evID Subject rating
1 event1 3.758
2 event2 3.758
3 event3 3.758
and so on.... I know what they should be but I se that it just took an average
once, do ya kinda see what im saying?? Is there any way to retrieve the unique
average for each event?
Thank You
glossen Guest



Reply With Quote

