Android Question Merging two tables without duplicates (SQL)

Devv

Active Member
Licensed User
Longtime User
i found this online
SELECT LastName, FirstName, Address, City, State, Zip
FROM Clients
UNION
SELECT LastName, FirstName, Address, City, State, Zip
FROM Patrons
ORDER BY LastName, FirstName;

how can i do that on b4a ?
 

Devv

Active Member
Licensed User
Longtime User
What error do you get when you use that query?

Thanks for fast respond, i have no experience with databases on android , so i'm looking for someone who can convert this queries to b4a code, and i will modify the code on my own.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
try this:
B4X:
Dim MyQuery As String 
MyQuery = "Select LastName, FirstName, Address, City, State, Zip FROM Clients " _
" UNION Select LastName, FirstName, Address, City, " _
& "State, Zip FROM Patrons ORDER BY LastName, FirstName"
Cursor1=SQL1.ExecQuery(MyQuery)
 
Upvote 0

Devv

Active Member
Licensed User
Longtime User
try this:
B4X:
Dim MyQuery As String
MyQuery = "Select LastName, FirstName, Address, City, State, Zip FROM Clients " _
" UNION Select LastName, FirstName, Address, City, " _
& "State, Zip FROM Patrons ORDER BY LastName, FirstName"
Cursor1=SQL1.ExecQuery(MyQuery)


Thank you very much can you please give me the full code with specifying the database path ?
 
Upvote 0

Yafuhenk

Active Member
Licensed User
Longtime User
Take some time to read the beginners guide. It's not only a matter of typing the code but also of understanding whats happening
 
Upvote 0
Top