View Single Post
  #17 (permalink)  
Old 07-26-2007, 04:47 AM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default Re: Use on group_concat

Hi Priyan,

Have u noticed one thing.Try this

CREATE TABLE testing(id INTEGER,name VARCHAR(10));
INSERT INTO testing VALUES (1,'1000,1010');
SELECT * FROM table_name WHERE table_id IN (SELECT name FROM testing);

The above query returns only one record from the table as per the first value from the field.

This is because the difference as follows

SELECT * FROM table_name WHERE table_id IN ('1000,1010'), trims the string to the INTEGER and takes just the first value.so the query will work as
SELECT * FROM table_name WHERE table_id IN ('1000');

Might be the same thing happens in the GROUP_CONCAT().

As you said that it will be very tedious for handling strings, each values has to be concated as a string and to get the result from the query.

Hope believe there will be more flexible String Functions are expected in MYSQL5.1.
__________________
-Murali..
Reply With Quote