Welcome, Guest
Please Login or Register.    Lost Password?

Pull data from 2 tables in database??
(1 viewing) (1) Guest
Welcome to the ToolsJX forum!


Go to bottomPage: 1
TOPIC: Pull data from 2 tables in database??
#360
Pull data from 2 tables in database?? 5 Months, 3 Weeks ago Karma: 0
Is there any way to pull data from two separate tables in the database and show them in one??
KawasakiMike9
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#361
Re:Pull data from 2 tables in database?? 5 Months, 3 Weeks ago Karma: 1
Hi,

you can create sql view and join tables together as you wish.
Then you show this view with TableJX.

Best regards,
Viljem
viljem
Admin
Posts: 152
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#362
Re:Pull data from 2 tables in database?? 5 Months, 3 Weeks ago Karma: 0
I want to keep the tables separate in the actual database though. Is there any way to search through multiple tables without actually combining them in the database and if so, how should I go about doing it?

- Michael
KawasakiMike9
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#366
Re:Pull data from 2 tables in database?? 5 Months, 3 Weeks ago Karma: 0
Hello Michael,

When you create a view on to tables they remain separate. With view you combine data from two (or more) tables, however they must have a connection (usually, but not neccessary, specified by foreign key). You create such view with by JOIN-ing - for example:

CREATE VIEW TABLE1TABLE2 AS
SELECT TABLE1.FIELD1, TABLE2.FIELD2 FROM TABLE1 INNER JOIN TABLE2 ON TABLE1.JOININGFIELD = TABLE2.JOININGFIELD

If you have a situation when you want to show rows from several tables, then you again create a view, but this time using UNION (see dev.mysql.com/doc/refman/5.0/en/union.html ).

You can then dispay data specified by such view with TableJX.

Regards,
Bostjan
Bostjan
Senior Boarder
Posts: 45
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
Tools JX, Powered by Joomla!; Joomla templates by SG web hosting