vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have several databases that are used to collect data for different client-projects. My intention was to collect the data, and administer mySQL so each client could see only their data. Each of these databases used to collect data have the same tables. There are other databases which are available to all the users which contain common information. The command "show databases" lists all of the databases (visible to the particular user) and not the one's I would like to display (the databases used to collect data). Is there a way to nest a single mySQL command to show only the databases that have the same particular table? |
| |||
| == Quote from judy (judy@shaw.ca)'s article > I have several databases that are used to collect data for different > client-projects. My intention was to collect the data, and administer > mySQL so each client could see only their data. Each of these > databases used to collect data have the same tables. There are other > databases which are available to all the users which contain common > information. > The command "show databases" lists all of the databases (visible to > the particular user) and not the one's I would like to display (the > databases used to collect data). Is there a way to nest a single > mySQL command to show only the databases that have the same particular > table? yes, potentially you can write a stored procedure to do this. you'll save the procedure in each database separately of course. -- POST BY: lark with PHP News Reader ;o) |
| |||
| On 5 Dez., 18:03, judy <j...@shaw.ca> wrote: > Is there a way to nest a single > mySQL command to show only the databases that have the same particular > table? You mean something like this? SELECT DISTINCT TABLE_SCHEMA FROM information_schema.TABLES WHERE TABLE_NAME = 'the_table_name_you_look_for' Regards, André |
| |||
| On 5 Dec, 23:28, "André Hänsel" <an...@webkr.de> wrote: > On 5 Dez., 18:03, judy <j...@shaw.ca> wrote: > > > Is there a way to nest a single > > mySQL command to show only the databases that have the same particular > > table? > > You mean something like this? > > SELECT DISTINCT TABLE_SCHEMA FROM information_schema.TABLES WHERE > TABLE_NAME = 'the_table_name_you_look_for' > > Regards, > André Except that will show tables not databases. |
| ||||
| On 6 Dez., 10:53, Captain Paralytic <paul_laut...@yahoo.com> wrote: > On 5 Dec, 23:28, "André Hänsel" <an...@webkr.de> wrote: > > > On 5 Dez., 18:03, judy <j...@shaw.ca> wrote: > > > > Is there a way to nest a single > > > mySQL command to show only the databases that have the same particular > > > table? > > > You mean something like this? > > > SELECT DISTINCT TABLE_SCHEMA FROM information_schema.TABLES WHERE > > TABLE_NAME = 'the_table_name_you_look_for' > > > Regards, > > André > > Except that will show tables not databases. Of course it shows databases, TABLE_SCHEMA contains the name of the database. |