Jump to content

Recommended Posts

Hi, I'm designing a db for a new application that involves some real estate stuff.

 

Its alot of data, and I was originally going to split them into 5 identical MyISAM tables:

 

`property_condos`, `property_singlefamily`, `property_multi`, `property_land`, `property_others`

 

and a MERGE table `properties_all` to rejoin them.

 

I couldnt simply set INSERT_METHOD because its restrictive to first / last table only.  I wanted to insert property into the table that correspond to its type.    Such as condos all go into the `property_condo` table.

 

So I relied on my script to do the job of selecting the correct table and doing the insert instead of inserting into `properties_all` and letting MERGE figure it out.

 

Now my issue:

 

Each table has an auto increment field `propertyID`, so if theres a row in each of the `property_x` table, there would be a `propertyID` = 1 in each table.  Essentially I end up with 5 rows on the merge table with `propertyID` = 1.

 

First time really working with MERGE tables so I didnt expect this. 

 

Is there any way to fix this?  Perhaps by `linking` primary auto increment keys across table?  Or is this a flaw in my db design? 

Link to comment
https://forums.phpfreaks.com/topic/171069-designing-a-new-db-merge-table-question/
Share on other sites

Why not use a signle table - `properties` and have a `proprty_type` field. That way all your properties are in one table, and can easily be filtered.

 

You can even have a second table - `property_types` with two fields `id` and `type`. When adding a property add the id of the property type rather than its textual value.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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