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 http://www.experts-exchange.com/Database/MySQL/Q_27475186.html)

What am I missing???

Best regards

Ullenulle
ullenulleAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lwadwellCommented:
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).
0
ullenulleAuthor Commented:
Yes, I noticed the same, but I do not have that space... it's so weird weird weird....
0
ullenulleAuthor 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

Ullenulle
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ullenulleAuthor Commented:
I solved the problem as stated above.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.