Jump to content

Data not showing


maxz_pc

Recommended Posts

Mysql version: 4.1.10

 

alerts.al_comment has the  data type TEXT

 

My SQL query

select alerts.al_id, alerts.al_comment, concat(users2.u_prenom,' ', users2.u_nom) as al_created_by, group_concat(users.U_NOM SEPARATOR ', ') as al_alerts_users, (SELECT count(*) from alerts as myTable where myTable.al_parent_id = alerts.al_parent_id group by alerts.al_parent_id) as nbRev 
from alerts 
	left join alerts_users on (alerts.al_parent_id = alerts_users.al_parent_id) 
	left join users on (alerts_users.u_id = users.U_ID) 
	join users as users2 on (alerts.u_id = users2.U_ID) 
WHERE 
	alerts.al_id = 429
GROUP BY alerts.al_id, alerts_users.al_parent_id ORDER BY al_date ASC LIMIT 100

 

Result obtained:

 

al_id   

 

al_comment   

 

al_created_by   

 

al_alerts_users   

 

nbRev   

 

429

 

--

 

John Smith

 

--

 

1

 

Result expected:

 

al_id   

 

al_comment   

 

al_created_by   

 

al_alerts_users   

 

nbRev   

 

429

 

It's weird

 

John Smith

 

--

 

1

 

 

I tried the query on mysql 5.0.27 and it works fine, i get the expected result

It seems that in Mysql 4.1.10 there is a problem with the TEXT data type and with groups by maybe...

 

Has anyone had a similar problem?

Thanks

Link to comment
Share on other sites

I tried changing group concat in the original query with this:

 

Didn't work

concat(group_concat(concat(users.U_NOM) SEPARATOR ', ')) 

 

Didn't work

group_concat(concat(users.U_NOM) SEPARATOR ', ') 

 

Didn't work

concat(group_concat(users.U_NOM SEPARATOR ', ')) 

 

I also tried adding an id in the WHERE statements, it works but it's not logical(or at least I don't understand why this works...):

Worked

replace

alerts.al_id = 429

by

alerts.al_id in (429, 429)

 

I would like to have a better solution than having to put the alerts.al_id twice... but if it's the only way thats what i will do

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.