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

Why does GROUP_CONCAT() function fail in MySQL 4.1.12 in this query?

Here are my results using MySQL 4.1.12 and I honestly don't think this
is right, but can't figure out what to do:

mysql> select id, group_concat(DISTINCT school_enrollment_time_name
SEPARATOR ',') as school_enrollment_time_display from
school_enrollment_time group by id;
+----+--------------------------------+
| id | school_enrollment_time_display |
+----+--------------------------------+
| 1 | spring |
| 2 | summer |
| 3 | fall |
+----+--------------------------------+
3 rows in set (0.00 sec)

mysql> select id, school_enrollment_time_name from
school_enrollment_time;
+----+-----------------------------+
| id | school_enrollment_time_name |
+----+-----------------------------+
| 1 | spring |
| 2 | summer |
| 3 | fall |
+----+-----------------------------+
3 rows in set (0.00 sec)

I need help in a hurry on this one, thanx
Phil

Feb 14 '06 #1
2 1693
<ph**************@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Here are my results using MySQL 4.1.12 and I honestly don't think this
is right, but can't figure out what to do:

mysql> select id, group_concat(DISTINCT school_enrollment_time_name
SEPARATOR ',') as school_enrollment_time_display from
school_enrollment_time group by id;


You're grouping by id, which I assume is a unique key.
So the groups are all guaranteed to be groups of exactly one row.

GROUP BY is traditionally used on fields in which values occur multiple
times.

Regards,
Bill K.
Feb 15 '06 #2

Bill Karwin wrote:
<ph**************@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Here are my results using MySQL 4.1.12 and I honestly don't think this
is right, but can't figure out what to do:

mysql> select id, group_concat(DISTINCT school_enrollment_time_name
SEPARATOR ',') as school_enrollment_time_display from
school_enrollment_time group by id;
You're grouping by id, which I assume is a unique key.
So the groups are all guaranteed to be groups of exactly one row.


id is a unique key, therefore, how will it be done to have a single row
consisting of the following:

if I selected ids (1, 2) then I would see the following string:
spring,summer
if I selected ids (1, 3) then I would see the followings tring:
spring,fall

Etc.

Phil

GROUP BY is traditionally used on fields in which values occur multiple
times.

Regards,
Bill K.


Feb 15 '06 #3

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

Similar topics

3
by: 4partee | last post by:
I'm trying to import a csv file with a PHP procedure. However, some of the lines in the csv file have missing values. When this command is given to mysql: insert tablex values...
2
by: phillip.s.powell | last post by:
SELECT s.id, s.student_first_name, s.student_last_name, IF(s.student_ethnicity_interest_other IS NOT NULL AND s.student_ethnicity_interest_other != '', CONCAT(s.student_ethnicity_interest_other,...
0
by: phillip.s.powell | last post by:
$if1 = "IF(s.student_ethnicity_interest_other IS NOT NULL AND s.student_ethnicity_interest_other != '', " . " CONCAT(s.student_ethnicity_interest_other, ', ', GROUP_CONCAT(e.ethnicity_name...
10
by: tuco357 | last post by:
This problem has been vexing me for some time and I thought I should consult the group.... Often times when writing a php script to handle some mysql DB transactions, I must write code that...
0
by: gmorris | last post by:
I am attempting to pull data from multiple tables into a resultset that I can use as an Excel spreadsheet for reporting. Here is my query so far: SELECT b.bug_id,p.realname as 'Assigned'...
6
by: lawrence k | last post by:
Wierd. Go to this page: http://www.ihanuman.com/search.php and search for "yoga" This query gets run: SELECT * FROM albums WHERE MATCH(name,description) AGAINST ('yoga') ORDER BY id DESC
2
rizwan6feb
by: rizwan6feb | last post by:
I have created a table (with only 2 fields) with the following query "CREATE TABLE `users` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `name` VARCHAR( 20 ) NOT NULL ) ENGINE = MYISAM ;" ...
5
by: Guillermo Antonio Amaral Bastidas | last post by:
Hi everybody, I have a quick and probably dumb question, keep in mind I just dumped my old love FastCGI + Perl for it's younger hotter friend PHP5. If the user calls a time consuming script...
1
bilibytes
by: bilibytes | last post by:
Hi, I'm wondering how to achieve the following: well i don't know if you guys like wine but I have to explain a very little on wine to explain my example: Wine is made from grape and a wine...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.