Union working in localhost MySQL Version 5.5.8 but not working on server MySQL - 5.7.24

49
January 13, 2019, at 05:20 AM

I have a table in which i am fetching Left & Right child of Parent via union query but there is a problem its working fine on localhost but union query fetch only first select statement on live server.

I am stuck whats going wrong?

Full Texts     TId  SId         LeftN      RightN   LStatus RStatus
Edit    Delete  1   -           AMSJUTATE               1    
Edit    Delete  2   AMSJUTATE   AMSNUDUCU   AMSFEZAVU   1   1
Edit    Delete  3   AMSNUDUCU   AMSGUWUDE   AMSTUTUNE   1   1
Edit    Delete  4   AMSFEZAVU   AMSXAWUXU   AMSHALURA   1   1
Edit    Delete  5   AMSGUWUDE   AMSZUCIVO   AMSKEFOFA   1   1
Edit    Delete  6   AMSTUTUNE   AMSFASOJA   AMSZAPUPE   1   1
Edit    Delete  7   AMSXAWUXU   AMSTEMUJI   AMSPOROBE   1   1
Edit    Delete  8   AMSHALURA   AMSBIZEZO   AMSFOHOFI   1   1
Edit    Delete  9   AMSZUCIVO   AMSXUDINE       1    
Edit    Delete  10  AMSKEFOFA   AMSZEVUTA       1    
Edit    Delete  11  AMSFASOJA   AMSREXEGI       1    
Edit    Delete  12  AMSZAPUPE   AMSBIXIBO       1    
Edit    Delete  13  AMSTEMUJI   AMSHEFOVI       1    
Edit    Delete  14  AMSPOROBE   AMSLUPAKE       1    
Edit    Delete  15  AMSBIZEZO   AMSCUSIPU       1    
Edit    Delete  16  AMSFOHOFI   AMSCEMUSU       1    
Edit    Delete  17  AMSXUDINE   AMSKATOTU       1    
Edit    Delete  18  AMSZEVUTA   AMSLECEVU       1    
Edit    Delete  19  AMSREXEGI       AMSKOVUSA       1
Edit    Delete  20  AMSBIXIBO       AMSLIWULO       1
Edit    Delete  21  AMSHEFOVI       AMSJOLOWE       1
Edit    Delete  22  AMSLUPAKE       AMSREROXE       1
Edit    Delete  23  AMSCUSIPU       AMSPOMUBE       1
Edit    Delete  24  AMSCEMUSU       AMSPULINU       1
Edit    Delete  25  AMSPULINU       AMSWOFIVO       1
Edit    Delete  26  AMSWOFIVO   AMSGUVESU   AMSREBEJI   1   1
Edit    Delete  27  AMSGUVESU                
Edit    Delete  28  AMSREBEJI       AMSWESIFE       1
Edit    Delete  29  AMSWESIFE   AMSBUSULA   AMSWEWERO   1   1
Edit    Delete  30  AMSBUSULA                
Edit    Delete  31  AMSWEWERO       AMSVAZUGI       1
Edit    Delete  32  AMSVAZUGI       AMSMILONE       1
Edit    Delete  33  AMSMILONE       AMSNITIRE       1
Edit    Delete  34  AMSNITIRE       AMSLOVISO       1
Edit    Delete  35  AMSLOVISO       AMSKEVEDA       1
Edit    Delete  36  AMSKEVEDA       AMSMOWAME       1
Edit    Delete  37  AMSMOWAME       AMSHAXIVE       1
Edit    Delete  38  AMSHAXIVE       AMSJOZEFE       1
Edit    Delete  39  AMSJOZEFE   AMSNOSEWA   AMSTAKOBE   1   1
Edit    Delete  40  AMSTAKOBE       AMSCOWUVO       1
Edit    Delete  41  AMSNOSEWA                
Edit    Delete  42  AMSCOWUVO       AMSVITIBU       1
Edit    Delete  43  AMSVITIBU       AMSRIRUCA       1
Edit    Delete  44  AMSKATOTU                
Edit    Delete  45  AMSLECEVU                
Edit    Delete  46  AMSKOVUSA                
Edit    Delete  47  AMSLIWULO                
Edit    Delete  48  AMSJOLOWE                
Edit    Delete  49  AMSREROXE                
Edit    Delete  50  AMSPOMUBE                
Edit    Delete  51  AMSRIRUCA       AMSBAGUDA       1
Edit    Delete  52  AMSBAGUDA   AMSDOSUKE   AMSMUDEFA   1   1
Edit    Delete  53  AMSMUDEFA   AMSPOBEWE       1    
Edit    Delete  54  AMSPOBEWE   AMSLIWEMI   AMSRUPOZO   1   1
Edit    Delete  55  AMSLIWEMI   AMSJEZAMA       1    
Edit    Delete  56  AMSJEZAMA                
Edit    Delete  57  AMSRUPOZO       AMSDEMEME       1
Edit    Delete  58  AMSDEMEME   AMSCOVUKU   AMSHUSATE   0   1
Edit    Delete  59  AMSHUSATE                
Edit    Delete  60  AMSCOVUKU   AMSDEFUSE       1    
Edit    Delete  61  AMSDEFUSE                
Edit    Delete  62  AMSDOSUKE   AMSBIFERI   AMSROVAJU   1   1
Edit    Delete  63  AMSBIFERI   AMSNATORU   AMSDIXINE   1   1
Edit    Delete  64  AMSNATORU   AMSSIWAPA       1    
Edit    Delete  65  AMSDIXINE                
Edit    Delete  66  AMSSIWAPA   AMSNIBEDO   AMSFOTUTU   1   1
Edit    Delete  67  AMSNIBEDO                
Edit    Delete  68  AMSFOTUTU   AMSLENADI       1    
Edit    Delete  69  AMSLENADI                
Edit    Delete  70  AMSROVAJU       AMSTEFIWO       1
Edit    Delete  71  AMSTEFIWO       AMSJOZAWE       1
Edit    Delete  72  AMSJOZAWE   AMSTEHOKU   AMSWUMIBO   0   0
Edit    Delete  73  AMSWUMIBO   AMSFUZISI   AMSDIXUME   0   0
Edit    Delete  74  AMSTEHOKU                
Edit    Delete  75  AMSFUZISI   AMSLOBUCO       0    
Edit    Delete  76  AMSDIXUME   AMSMODITO   AMSJELIVI   0   0
Edit    Delete  77  AMSLOBUCO                
Edit    Delete  78  AMSJELIVI   AMSWUJIJA   AMSVIZAFU   0   0
Edit    Delete  79  AMSWUJIJA                
Edit    Delete  80  AMSMODITO                
Edit    Delete  81  AMSVIZAFU   AMSZIJETI   AMSZEZEZI   0   0
Edit    Delete  82  AMSZIJETI   AMSWAWASI       0    
Edit    Delete  83  AMSZEZEZI                
Edit    Delete  84  AMSWAWASI   AMSKIDUFU       0    
Edit    Delete  85  AMSKIDUFU   AMSJOROKE       0    
Edit    Delete  86  AMSJOROKE               

I am showing what query i used

    select leftn as SId
from tree
inner join (select @sid:=(select group_concat(leftn,',',rightn)
                          from tree
                          where find_in_set(sid, @nsid) >= 1)
                 , @nsid:=@sid as fset
            from tree, (select @nsid:='AMSJUTATE',@sid='')v )gr
        on find_in_set(leftn,fset)
where leftn <> ''
union
select rightn as SId
from tree
inner join (select @sid:=(select group_concat(leftn,',',rightn) 
                          from tree
                          where find_in_set(sid, @nsid) >= 1)
                 , @nsid:=@sid as fset
            from tree, (select @nsid:='AMSJUTATE',@sid='')v )gr
        on find_in_set(rightn,fset)
where rightn <> ''

When i fetch on localhost MySQL Version 5.5.8 its working, but not working on server MySQL - 5.7.24 on server. it returns first select statement only.

READ ALSO
Is there any Filtering query in Mysql to sorty by relevance?

Is there any Filtering query in Mysql to sorty by relevance?

Is there any way to write a filtering query for the following scenario in mysql

28
Database design for B2B2C system

Database design for B2B2C system

I want to create an application, where my direct clients are business personThey would use the application to make transactions with their customers

30
i can&#39;t get the following $resultCheck to redirect

i can't get the following $resultCheck to redirect

I have the following code and it is displaying the select tag options as $level1promo_competition based on what is in my databaseThe thing that is puzzing me is that if I changed the name in my database or my variable to something else other than what is in my database,...

42
how to call json with and without data [on hold]

how to call json with and without data [on hold]

i tried to make a json from php and want it can be get with data like http://localhost/moviereview/?action=get_review&genre=biography and or without data like http://localhost/moviereview/?action=get_review

32