https://antibiotiqueaugmentin.com/surdosage-augmentin-bebe/
× Welcome to the ToolsJX forum!


Pull data from 2 tables in database??

  • KawasakiMike9
  • KawasakiMike9's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
14 years 1 month ago #360

Is there any way to pull data from two separate tables in the database and show them in one??

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #361

Hi,

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

Best regards,
Viljem

Please Log in or Create an account to join the conversation.

  • KawasakiMike9
  • KawasakiMike9's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
14 years 1 month ago #362

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

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #366

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

Please Log in or Create an account to join the conversation.

Moderators: tomaz
Time to create page: 0.163 seconds

Contact Us

Contact us on Discord

Contact us on Facebook