---
title: "Vad kan jag ha missat"
type: "forum-thread"
url: "https://www.webforum.nu/amne/databaser-sql/21887-vad-kan-jag-ha-missat"
topic: "Databaser & SQL"
topic_url: "https://www.webforum.nu/amne/databaser-sql"
author: "erka"
published: "2002-01-11T14:17:00.000Z"
updated: "2002-01-14T08:30:00.000Z"
replies: 2
views: 133
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/databaser-sql/21887-vad-kan-jag-ha-missat"
---

# Vad kan jag ha missat

## #1 — erka, 2002-01-11T14:17Z

Hej. Jag har ett litet register med 50 stycken addresser, så fort jag försöker få ut något från tabellen CountryStates så kommer endast de addresser som har något i fältet stateId i tabellen distributors upp. Om jag skiter i att ta med tabellen CountryStates så får jag fram alla 50. Vad kan jag har gjort för fel i mina relationer, fält.

```
SELECT Distributors.DistId, Distributors.Countryname_ID, Distributors.Name, Distributors.Adress1, Distributors.Adress2, 
Distributors.StateId, Distributors.Zip, Distributors.City, CountryName.CountryName_ID, CountryName.CountryName_GB, 
CountryName.CountryCode, CountryStates.StateId, CountryStates.StateName, CountryStates.StateCode FROM Distributors INNER JOIN CountryName ON Distributors.Countryname_ID = CountryName.CountryName_ID INNER JOIN
CountryStates ON Distributors.StateId = CountryStates.StateId AND 
CountryName.CountryName_ID = CountryStates.CountryName_ID
```

Permalänk: https://www.webforum.nu/p/21887

## #2 — LarsG, 2002-01-11T14:59Z

```
SELECT Distributors.DistId, Distributors.Countryname_ID, Distributors.Name, Distributors.Adress1, Distributors.Adress2, 
Distributors.StateId, Distributors.Zip, Distributors.City, CountryName.CountryName_ID, CountryName.CountryName_GB, 
CountryName.CountryCode, CountryStates.StateId, CountryStates.StateName, CountryStates.StateCode FROM Distributors inner JOIN CountryName ON Distributors.Countryname_ID = CountryName.CountryName_ID [b]left outer[/b] JOIN
CountryStates ON Distributors.StateId = CountryStates.StateId AND 
CountryName.CountryName_ID = CountryStates.CountryName_ID
```

så borde du få med även de där ststeid inte är satt.

Permalänk: https://www.webforum.nu/p/353684

## #3 — erka, 2002-01-14T08:30Z

Tack lars g !

Permalänk: https://www.webforum.nu/p/353685

---

Tråden på webben: https://www.webforum.nu/amne/databaser-sql/21887-vad-kan-jag-ha-missat
