Error #1064 in MySQL...

Hi there.

I hope you can help me again. When I make the following query:

select r.1_kemoterapi_id, r.patient_id_1_kemoterapi, r.1_linie_kemoterapi,
'serie1' as serie1,a.carboplatin_dosis as carboplatin_dosis1,a.carboplatin_givet as carboplatin_givet1,a.carboplatin_reduceret_aarsag as carboplatin_reduceret_aarsag1, a.carboplatin_reduceret_andet_angiv as carboplatin_reduceret_andet1,
'serie2' as serie2,b.carboplatin_dosis as carboplatin_dosis2,b.carboplatin_givet as carboplatin_givet2,b.carboplatin_reduceret_aarsag as carboplatin_reduceret_aarsag2, b.carboplatin_reduceret_andet_angiv as carboplatin_reduceret_andet2,
'serie3' as serie3,c.carboplatin_dosis as carboplatin_dosis3,c.carboplatin_givet as carboplatin_givet3,c.carboplatin_reduceret_aarsag as carboplatin_reduceret_aarsag3, c.carboplatin_reduceret_andet_angiv as carboplatin_reduceret_andet3,
'serie4' as serie4,d.carboplatin_dosis as carboplatin_dosis4,d.carboplatin_givet as carboplatin_givet4,d.carboplatin_reduceret_aarsag as carboplatin_reduceret_aarsag4, d.carboplatin_reduceret_andet_angiv as carboplatin_reduceret_andet4
from tbl_1_kemoterapi r
left join tbl_1_kemoterapi_beh a on a.patient_id_1_kemoterapi = r.patient_id_1_kemoterapi and a.serie = 1
left join tbl_1_kemoterapi_beh b on b.patient_id_1_kemoterapi = r.patient_id_1_kemoterapi and b.serie = 2
left join tbl_1_kemoterapi_beh c on c.patient_id_1_kemoterapi = r.patient_id_1_kemoterapi and c.serie = 3
left join tbl_1_kemoterapi_beh d on d.patient_id_1_kemoterapi = r.patient_id_1_kemoterapi and d.serie = 4

... I get this error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.1_kemoterapi_id , r . patient_id_1_kemoterapi , r .1_linie_kemoterapi ,  'serie' at line 1

It's driving me crazy, because I made an examply work just fine (look at my question earlier today on

What am I missing???

Best regards

Who is Participating?
ullenulleConnect With a Mentor Author Commented:
Ok.. I figured out what's wrong. It was an issue with the relation, key and stuff.  tbl_1_kemoterapi is a parent to  tbl_1_kemoterapi_beh , BUT tbl_1_kemoterapi  has a parent too (tbl_patient), so I made the same query above, just with tbl_patient in stead of tbl_1_kemoterapi. Then I got, what I want, since the same key-variable is present in all 3 tables. I still can't understand why it didn't work the other way around... hmmmm... anyway. I'll close this question now. Thanks for your effort.
Best regards

I am confused by the blank space between the 'r' and the '.' in the error message - as supplied above; the SQL does not appear to have that spaces (which would be bad if they existed).
ullenulleAuthor Commented:
Yes, I noticed the same, but I do not have that space... it's so weird weird weird....
ullenulleAuthor Commented:
I solved the problem as stated above.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.