Dostęp: łącz tabele i zapytania - jak to działa
Aby połączyć tabele i zapytania w programie Microsoft Access, musisz wziąć pod uwagę kilka rzeczy. Istnieją różne kryteria, według których możesz łączyć swoje tabele, takie jak łącze wewnętrzne i zewnętrzne. Ta praktyczna wskazówka pokazuje, jak to zrobić w programie Microsoft Access 2007.
Dostęp: łącz tabele i zapytania do łącza wewnętrznego
Jeśli masz plik Access, który zawiera już różne tabele, możesz je połączyć.
- Użyj zakładki „Relacje”, aby utworzyć relacje między tabelami. Tam wybierz pożądaną relację, która najlepiej reprezentuje relację między tabelami. Jeśli już utworzyłeś relację, program Access automatycznie utworzy wewnętrzne łącze między tabelami, gdy dodasz nowe tabele do zapytania.
- Jeśli utworzysz nowe zapytanie i między tabelami nie będzie żadnych relacji, program nie utworzy automatycznie łącza.
- Aby utworzyć łącze, przeciągnij teraz pole z jednej tabeli do pola innej tabeli.
- Składnia SQL, której należy użyć, aby użyć łącza wewnętrznego, wygląda następująco, na przykład: FROM table1 INNER JOIN table2 ON table1.field1 operator porównania table2.field2.
- Operatorem porównania jest na przykład „” lub „=”.
Dostęp: łącz tabele i zapytania do łącza zewnętrznego
Kolejnym linkiem jest link zewnętrzny. Pokazuje wszystkie wiersze z jednej tabeli i tylko wiersze z drugiej pasujące do pierwszej tabeli.
- Ponieważ linki zewnętrzne są tworzone przez modyfikację łącza wewnętrznego, musisz najpierw utworzyć łącze wewnętrzne między dwiema tabelami.
- Najpierw musisz przejść do menu, aby zmienić link. Dlatego kliknij dwukrotnie link, który chcesz edytować.
- Możesz teraz wybrać pomiędzy opcją 2 a opcją 3. Wybierz żądaną opcję i potwierdź przyciskiem „OK”.
- Składnia SQL potrzebna do złączenia zewnętrznego wygląda następująco w porównaniu ze składnią złączenia wewnętrznego: FROM Table1 [LEFT | PRAWO] DOŁĄCZ tabela2 ON tabela1.field1 operator porównania tabela2.field2.
- Podobnie jak w przypadku łącza wewnętrznego, musisz dostosować przykład do swoich tabel.
- Aby usunąć skrót, jeśli popełniłeś błąd, po prostu wybierz skrót i naciśnij klawisz „DEL”.