Hi Andrew,

You don't need to use seperate tables for each company. In fact you
shouldn't since select queries with index are fast.
I suggest,

1 table for the cities at least two columns, one for a unique column with
autoincrement(cityid), the other is the city names, with appropriate column
types
2nd table for companies , one column for a unique column with autoincrement,
the other columns to hold the company information as necessary, and the
least column to hold the attached cityid.

When you retrieve the cityid from the user with your web form, you simply
use:
SELECT * from company where cityid='cityid'
then display the results,

When you wish to add a new company, you simply insert the company
information to one table, with the city reference.

hope it helps.
arda


----- Original Message -----
From: "Andrew Maynes" <[EMAIL PROTECTED]>
To: "MySQL-Lista" <[EMAIL PROTECTED]>
Sent: Saturday, February 22, 2003 10:13 PM
Subject: Another Query Table Structure


> This may be simple for most of you MySQL experts out there so a little
help
> would be nice :)
>
> I have an index page that is using a Navigation system based on the ID
from a
> table City:
>
> The link then goes a DIR for that City.
>
> http://www.theaddress.co.uk/City/
>
> The navigation within this DIR is based on Traders for this City so my
problem
> is?
>
> Do I create a table for each City (holding Companies) or is there a way to
> structure the MySQL DB that can hold all companies in the same table?
>
> So when the City is selected all the companies for that City will be
listed,
> baring in mind that all the TraderID's are generic (the same as City)
It's only
> the Company that is specific to City?
>
> Help greatly needed and appreciated
>
> Andrew
>
>
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to