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?

use MySQL SET syntax to hide repeated cols output?
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: use MySQL SET syntax to hide repeated cols output?
#55938
use MySQL SET syntax to hide repeated cols output? 8 Years, 9 Months ago Karma: 0
I wish to hide the contents of some columns produced by a JOIN.
MySQL docs show that
SET @previous:="";

SELECT IF(summary=@previous, "", @previous:=summary), ...

does it fine in PHPMyAdmin;
result 1 IVFDF Ceilidh Spot Fri 27 Feb 15 RichardA
result 2 ----- title hidden ---- Fri 27 Feb 15 RichardA


but produces syntax error 1064 in ARI Datatables output, with or without the semi-colon

Can we do this SET in the SQL Query box and what would be syntax be please?
Thanks
Trevor
The administrator has disabled public write access.
 
#55939
Re:use MySQL SET syntax to hide repeated cols output? 8 Years, 9 Months ago Karma: 748
Hello,

Only one query can be defined in "SQL -> SQL query" parameter. SET and SELECT are two queries. You can create a store procedure and then call it into the module or use a query something like this:


SELECT
IF(summary=@previous, "", @previous:=summary)
FROM
tbl, (SELECT @previous:="") T


Regards,
ARI Soft
The administrator has disabled public write access.
 
#55940
Re:use MySQL SET syntax to hide repeated cols output? 8 Years, 9 Months ago Karma: 0
Hello, can you clarify 1. how to create a store procedure and
2. does that secondary query have to HAVE a real table called eg tbl;

my single query starts
SELECT IF(summary=@previous, "", @previous:=summary) AS title, ,,,, from 'various joins' etc -
I am trying to suppress the second and subsequent display of the same event title (and date etc)

if in PHPMyAdmin I perform the SET query, then the main query works ie gets it from a session variable?
Thanks
Trevor
The administrator has disabled public write access.
 
#55941
Re:use MySQL SET syntax to hide repeated cols output? 8 Years, 9 Months ago Karma: 748
You can read about stored procedures here.

Replace "tbl" with a name of table which contains "summary" column.

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