473,569 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(DI STINCT school_enrollme nt_time_name
SEPARATOR ',') as school_enrollme nt_time_display from
school_enrollme nt_time group by id;
+----+--------------------------------+
| id | school_enrollme nt_time_display |
+----+--------------------------------+
| 1 | spring |
| 2 | summer |
| 3 | fall |
+----+--------------------------------+
3 rows in set (0.00 sec)

mysql> select id, school_enrollme nt_time_name from
school_enrollme nt_time;
+----+-----------------------------+
| id | school_enrollme nt_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 1699
<ph************ **@gmail.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.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(DI STINCT school_enrollme nt_time_name
SEPARATOR ',') as school_enrollme nt_time_display from
school_enrollme nt_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.goo glegroups.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(DI STINCT school_enrollme nt_time_name
SEPARATOR ',') as school_enrollme nt_time_display from
school_enrollme nt_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
2188
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
1916
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, ', ', e.ethnicity_name), GROUP_CONCAT(DISTINCT e.ethnicity_name ORDER BY upper(e.ethnicity_name)) ) AS ethnicity_name FROM student s, ethnicity...
0
1217
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 ORDER BY upper(e.ethnicity_name))), " . ' GROUP_CONCAT(e.ethnicity_name ORDER BY upper(e.ethnicity_name))' . " ) AS ethnicity_name \n\n"; This...
10
1455
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 performs, say, an insert into a MySQL DB, then retrieves the last item's index, and makes a new insertion into another table on the DB that requires the...
0
3314
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' ,bug_status,b.resolution,b.short_desc,l.thetext as 'Description/Comments',b.creation_ts as 'Opened',b.delta_ts as 'Last Update' FROM bugs b, longdescs...
6
3521
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
1784
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 ;" There are 20,000 users in this table with ids from 1 to 20,000
5
2849
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 and then stops or refreshes the browser before the script had time to finish will Apache kill the script mid execution or will it let it finish ? I...
1
5743
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 bottle may be made from different sorts of grape. So when you have a bottle it usually says: 10% of shyra, 50% of cabernet and 40% of merlot meaning...
0
7697
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.