mysql - Join tables where columns have spaces in them -


i can't seem 1 working. have 2 tables want join 1 of columns has space in few of titles. trying following code out success.

i have not bought in columns join yet because want test can make join.

select rcm.activitydatetime, rcm.'lead id', rcm.'new stage' customername_leads_by_lifecycle_stage_rcm rcm inner join customername_leads leads on rcm.'lead id' = leads.id; 

the warning

you have error in sql syntax; check manual corresponds mysql server version right syntax use near ''lead id', rcm.'new stage' customername_leads_by_lifecycle_stage_rcm rcm inne' @ line 1 

any appreciated, thanks!

use backticks (`) rather single quotes (') column names

select rcm.activitydatetime, rcm.`lead id`, rcm.`new stage` customername_leads_by_lifecycle_stage_rcm rcm inner join customername_leads leads on rcm.`lead id` = leads.id; 

you may consider renaming columns don't have spaces.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -