Jump to content

get the table name from query that query 3 tables


houssam_ballout

Recommended Posts

Hello,
I had this issue in mysql:
I had made a query which select data from 3 tables, using UNION command, and its getting the results, when I want to display the results in a php page , I need to know the table that each record had been retrieved from, how can I do it?
Thanks in advance

 

Link to comment
Share on other sites

Query:

 

<pre>SELECT * FROM sys.tables</pre> or <pre>SELECT * FROM sysobjects WHERE xtype = 'U'</pre> --- If you are using Oracle, you can use one of these: <pre>SELECT * FROM all_tables;</pre> or <pre>SELECT * FROM all_objects WHERE object_type = 'TABLE';</pre>

Edited by Lala55
Link to comment
Share on other sites

  • 2 months later...

Query:

 

<pre>SELECT * FROM sys.tables</pre> or <pre>SELECT * FROM sysobjects WHERE xtype = 'U'</pre> --- If you are using Oracle, you can use one of these: <pre>SELECT * FROM all_tables;</pre> or <pre>SELECT * FROM all_objects WHERE object_type = 'TABLE';</pre>

 

Sometimes, the process of building and using queries is a simple matter of selecting fields from a table, perhaps applying some criteria, and then viewing the results. But what if, as is more often the case, the data you need is spread out in more than one table? Fortunately, you can build a query that combines information from multiple sources......

 

Duplichecker - free online plagiarism checker

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.