I have a mysql table field FullPath

I want to show two fields in this field and am using
SELECT concat(boats.imagedirectory,' ',boats.image1_thumb) AS FullPath FROM boats to do this.
I cannot see an error but the field FullPath is empty.

Can anyone see my error please?

Many thanks
Who is Participating?
Julian HansenConnect With a Mentor Commented:
That should work - what are your fields defined as for
imagedirectory and image1_thumb
Try this
SELECT boats.imagedirectory, boats.image1_thumb, concat(boats.imagedirectory,' test') AS FullPath FROM boats

Open in new window

and this
SELECT concat(boats.image1_thumb,' test') AS FullPath FROM boats

Open in new window

In both cases verify data is coming out as expected.
Kim WalkerWeb Programmer/TechnicianCommented:
Check for upper case and lower case letters in the field names in your database. I've seen odd situations with case-sensitivity where the query returned an empty field without error when the field name was improperly capitalized.
johnhardyAuthor Commented:
Thanks Julian

I changed your suggested code a little and its now working OK

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

What does
select concat_ws(' ',imagedirectory,image1_thumb) as full_path from boats result in?
johnhardyAuthor Commented:
Thanks awking00

That gave the correct the correct result.

I'm not sure of the difference of concat and concat_ws

You realise the question is closed now but thanks anyway

The difference is that if any arguments using concat are null, it will return null, while concat_ws will skip any null arguments (although it will return null if the separator is null).
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.