Hi List, I've a question about inserting values in tables with promary-keys. I have two tables: 1. Table ( contains limits for testing ) - int limitId primary key - int lowerlimit - int upperlimit - char(5) measureunit - char(10) measurename 2. Table ( contains measured values ) - int measureid - float measuredvalue In the 2nd table I stored all measurements taken in a production. For one day that will be more than 100000 values. In the 1st table I stored the testlimits. maybe 100 diffrent values Table 1 and Table 2 were linked togther with the id's. So every measured value in tab2 has a testlimit definition in tab1. Later I want to do a query about all measured values for measureid=limitid, and make some statistics about nr of failed, passed, average or standarddeviation. The query is not my problem. My problem is how to insert values into these two tables. My thougts were: Every time I put a new measured value into tab 2 I need first to query tab1 to find out the limitid that I have to use as the measureid for tab2. So for every insert I need one query on tab1? Or is their a better way to get the idvalue for tab2? In the first design a had all values ( measureid, lowerlimit, upperlimit, unit, name, measuredvalue ) in one table. This works fine. But with 100000 rows per day, the table grows to much. SO want to change the design and use the id's. Best regards Thorsten Guddack --------------------------------------------------------------------- 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
Insert values in tables with indices
Guddack Thorsten ICM MP SCM SCCM PI Fri, 17 Aug 2001 02:16:03 -0700