Custom field SQL select from two columns

  • Patrick
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
5 years 6 months ago - 5 years 6 months ago #117587 by Patrick
Hello

I use a custom field of type SQL. There I use this statement:
Code:
SELECT name_kind_1 AS value, name_kind_1 AS text FROM #__jsn_users WHERE id = [USER_ID]

This works fine. Now I need to get the data from column name_kind_2 as well. So I try:

Code:
SELECT name_kind_1, name_kind_2 AS value, name_kind_1, name_kind_2 AS text FROM #__jsn_users WHERE id = [USER_ID]

But this gives me value of name_kind_2 only. How can I get all data?

Thank you very much.

Patrick
Last edit: 5 years 6 months ago by Patrick.

Please Log in or Create an account to join the conversation.

More
5 years 6 months ago #117610 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Custom field SQL select from two columns
Hi Patrick

It depends on how you want to get data. I guess you can use mysql CONCAT_WS function from mysql to return the value of two fields to use dev.mysql.com/doc/refman/8.0/en/string-f...l#function_concat-ws

Tuan

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc