Need help with Joomla? We are available for hire to help with Joomla customization, upgrades, maintenance, and custom development.
Explore our services

Custom field SQL select from two columns

  • Patrick
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 1 month ago - 8 years 1 month 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: 8 years 1 month ago by Patrick.

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

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
8 years 1 month 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