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 bottom
Post Reply
Post New Topic
Page: 1
TOPIC: Pull data from 2 tables in database??
#360
Pull data from 2 tables in database?? 1 Year, 11 Months ago Karma: 0
Is there any way to pull data from two separate tables in the database and show them in one??
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
KawasakiMike9
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
#361
Re:Pull data from 2 tables in database?? 1 Year, 10 Months 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
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
viljem
Admin
Posts: 181
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
#362
Re:Pull data from 2 tables in database?? 1 Year, 10 Months 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
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
KawasakiMike9
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
#366
Re:Pull data from 2 tables in database?? 1 Year, 10 Months 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
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
Bostjan
Senior Boarder
Posts: 46
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
Go to top
Post Reply
Post New Topic
Page: 1
Moderators: tomaz
Tools JX, Powered by Joomla!; Joomla templates by SG web hosting