How to use union in query

Thanks @s.alpaslan - sorry for the delay in getting back to you. Yes, I’ve done that but as you can do joins in Wappler I wondered if unions might be possible too.

Create view in mysql

SELECT column_name(s) FROM table1
UNION
SELECT column_name(s) FROM table2 ;

Then use it in wappler . You can see your view like table in wappler query builder

1 Like

@s.alpaslan have you tried to use a view with wappler?
in my case it didn’t work

Yep, that’s exactly what I did - just wondered if you could do it directly in Wappler - not really any need to do it in Wappler but just nice to be able to do it all in one place - I appreciate you help

As @s.alpaslan says, a view appears just as a table does in Wappler. The view I’ve just created works just as a table would.

I would just say that I had to open the connection and save it again for the view to appear in the tables list in query builder - restarting Wappler does the same thing

did you try to display the view result in a page?

Yes it works fine - this is a test page - the result is from 3 tables with slightly different column names brought together with aliases - the three tables joined with unions and then brought into Wappler as though the view was a table https://tgoshopping.com/beta-01-02.php

1 Like

what is MySQL version you have? in my case i get an error about prepared statements.

Prepared statements … it is mysql bug

yea. wappler team say they may have a solution but im stuck currently.

MySQL version is : 5.6.40

im on mysql (10.2.16-MariaDB)
so views work fine on your version.
cant control the version on my hosting. damn :slightly_smiling_face:

That’s a real pain for you - I haven’t often used views before - wasn’t really necessary. But now I’ve had to because of Wappler I realise what I’ve been missing.

I was about to update to this version until I saw your post the other day. So glad I didn’t. My host is giving me multiple choices and I honestly am a bit nervous what to choose because it says I can not go back.

Current version MySQL 5.6 says near end of life
MySQL 5.7
MariaDB 10.0
MariaDB 10.1
MariaDB 10.2 which they recommend

The reason I am concerned is because it has a message at the top saying
“After you upgrade MySQL/MariaDB, there is no supported way to downgrade to the previous version.”

Maybe @Teodor has some advice on this or @wappler_ambassadors

You know what they say: Irreversible Updates that break things = Job Security.

1 Like

I have exactly the same choice and was going to update at the weekend - I think now I might put that on hold for the moment

That’s already possible using the Server Connect Array List component:

This topic was automatically closed after 26 hours. New replies are no longer allowed.