Tak til Terry og Dimble for savr til Whistler, de hjalp mig på vej. Nu er mit problem, hvordan finder jeg den record der skal sammenlignes i en INNER JOIN, jeg har forsøgt meget, men får altid svr fra første record.
Not sure I understand the problem! With an INNER JOIN there MUST be matching records in both tables. This is th esyntax for an INNER JOIN
"SELECT CategoryName, ProductName FROM Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID;"
Definition of an INNER JOIN Combines records from two tables whenever there are matching values in a common field. Definition of OUTER (RIGHT and LEFT) JOINS Use a LEFT JOIN operation to create a left outer join. Left outer joins include all of the records from the first (left) of two tables, even if there are no matching values for records in the second (right) table. Use a RIGHT JOIN operation to create a right outer join. Right outer joins include all of the records from the second (right) of two tables, even if there are no matching values for records in the first (left) table.
Example of LEFT (OUTER) JOIN "SELECT CategoryName, ProductName FROM Categories LEFT JOIN Products ON Categories.CategoryID = Products.CategoryID;"
Mit problem er at jeg skal finde en record f.eks. på et varenr., i denne record står der i et felt "Varenavn" et nr. til en til en relationsdatabase, hvor Varenavnet skal findes når nr. og tabellens autonr. matcher. Jeg kan godt finde min record når jeg søger på varenr., men når jeg bruger INNER JOIN tager den altid nr. og dermed Varenavnet fra første record. Skal INNER JOIN lægges ind under f.eks. LEFT JOIN ?, hvis JA hvordan gør jeg det.
send you db to dktebrsa@europe.lego.com and I will take a look.
If the varenr in BOTH tables are the same then an INNER JOIN will(should) work. You only use OUTER (LEFT or RIGHT) if you want to see the record even IF one side of the join is empty (no record).
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.