Jump to content

Archived

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

geus

I'm trying something

Recommended Posts

I have one table with users and for each user a table with a list of 8 names.

 

Is there a possibility to make a select from - and then an array or something to call all tables with the names in the users table

 

Or am I trying something that isn\'t possible ?

Share this post


Link to post
Share on other sites

Not exactly.

 

I want to collect data from other tables with the names of the users in my users table.

 

But I don\'t want to adjust the script each time a user is added so is it possible that it calls all tables with the names of the users in the user table.

Share this post


Link to post
Share on other sites

this would be possible using that loop syntax.

 

for example:

 

select * from users

would return: bill, bob, joe

 

this will return the names in the users table even if it is updated. then use that array to make whatever you need.

Share this post


Link to post
Share on other sites
I have one table with users and for each user a table with a list of 8 names.

 

Is there a possibility to make a select from - and then an array or something to call all tables with the names in the users table

 

Or am I trying something that isn\'t possible ?

 

Basically this is not the best design.

 

Make two tables:

 

1. Having the usernames called users

2. Having the 8 names and the username

 

Like

 

A:

Billy

Bob

Thornton

 

B:

Billy Donald

Billy Duck

Billy Palle

Bob Bush

Bob Sadam

and so on...

 

To get Billys friends...

 

select * from a left outer join b on a.user = b.user where a.user=\'Billy\';

 

P.

Share this post


Link to post
Share on other sites

No it\'s something else.

 

I have one table wit users and their data.

 

Then I have for each user a table where they can store data for their own.

 

so

table users

user1

user2

user3

 

and then i have tables called user1, user2, user3

 

I want to collect all data for example

select * from user1

select * from user2

and so on

Share this post


Link to post
Share on other sites

Ok, but if the design of table user1 and user2 and so on are identical, i.e. same number of coloumns, format etc. then it\'s a lot better to make one big table to hold this information.

Then just make a single coloumn identifying the \"owner\" of the current row (the username).

 

Otherwise you could quickly end up having a lot of tables, and you would need to allow create table permissions to your scripts.

 

P.

Share this post


Link to post
Share on other sites

×

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.