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

 

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>

  • 2 months later...
  On 5/27/2013 at 9:24 AM, Lala55 said:

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.