Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.

  • 21/11/2023 BLACK FRIDAY 23 is coming

    BIG SALE, 35% discount for all our extensions. Use BF23 coupon code. Hurry up the discount is valid till 27 November.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Identical Column Name and Text Drops One
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Identical Column Name and Text Drops One
#24256
Identical Column Name and Text Drops One 12 Years, 2 Months ago Karma: 0
I'm using an SQL query to display some data in an ARI Data Table. The query looks something like this:
SELECT 'ColumnA', ColumnA
FROM Table1
WHERE <condition>
UNION
SELECT 'ColumnB', ColumnB
FROM Table1
WHERE <condition>

The query is structured this way to 'transpose' the columns to rows (since I don't know of a MySQL function that does that) and display the column name/heading next to the value. I always retrieve only one row because of the <condition>.
The problem is that the display only shows the column value and strips out the '<column name>'. Reversing the order of the '<column name>' text and column reverses the result i.e. only the last item is displayed. Changing the text so it's not identical to the column name (e.g. 'ColumnAx') fixes the problem as does applying an alias to the column (e.g. ColumnA as ColumnAx).
In short somewhere along the way a parsing routine is stripping everything identical and leaving only the last item.
When running the same query in the PHPadmin interface it works fine.
Not sure if others have encountered this but I'm posting this in the hope that tech support will be able to address it.
Thanks.
The administrator has disabled public write access.
 
#24321
Re:Identical Column Name and Text Drops One 12 Years, 2 Months ago Karma: 747
Hello,

If you want to use ' symbol in column name, use the next SQL query:

Code:


SELECT '`ColumnA'`, ColumnA
FROM Table1
WHERE <condition>
UNION
SELECT `'ColumnB'`, ColumnB
FROM Table1
WHERE <condition>



It is not "ARI Data Tables" issue in this way it is implemented in Joomla! database class.

Regards,
ARI Soft
The administrator has disabled public write access.
 
Go to topPage: 1