database design help mysql

Soldato
Joined
7 Jan 2007
Posts
10,607
Location
Sussex, UK
Am I going to run into trouble when I join 10 tables and then attempt to select columns that aren't in all tables?

I want to select only 5 of the last rows on 10 tables, but some of the columns don't exist in all tables.

Is this a problem?
 
I suppose I could select the Nth row when all tables are joined instead of worrying about this?

At most I would want to do a top10, so that's 10 separate queries I guess....
 
Last edited:
Ok, lets say I am a project manager and I have to document how much I spend for each month a project is alive:

Project 1

Jan--Feb--Mar---timestamp
10---20---22----

Project 2

Jan--Feb--Mar--Apr----timestamp
12---08----14---15

I want to join the two tables and then something like:

while($row = mysql_fetch_array($result))
{
echo $row['Jan'];
echo " " . $row['Feb'];
echo " " . $row['Mar'];
echo " " . $row['Apr'];
echo "<br />";
}

But this will do funky things in the html as project1 doesn't have an Apr column
 
it's logging bingo balls so one table that only logs one type of game might have say 8 columns ball1 up to ball8


a second table may have a game with 10balls so will have ball1 column up to ball10 column.

I want to select the last 5 rows by timestamp and print all the rows for balls 1-8 or 10 if it has more balls.

Am I making sense? :p
 
would that not leave blank html tags?

i want to put $rows[ball1] - $rows[ball14] into <il. tags so i can style then.

ah so by checking for if its null it will remove them from the array but still print games that have it?

I guess before I print the results I need to check for null values and remove them from there $row arrays?

I could use array_filter, does this work on multi-dimensional arrays?
 
Last edited:
Back
Top Bottom