Posted on 2012-08-15
Medium Priority
Last Modified: 2012-08-16
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
Question by:johnhardy
LVL 60

Accepted Solution

Julian Hansen earned 2000 total points
ID: 38297982
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.
LVL 22

Expert Comment

by:Kim Walker
ID: 38298090
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.

Author Closing Comment

ID: 38298176
Thanks Julian

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 32

Expert Comment

ID: 38298199
What does
select concat_ws(' ',imagedirectory,image1_thumb) as full_path from boats result in?

Author Comment

ID: 38300432
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

LVL 32

Expert Comment

ID: 38300820
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).

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question