tleeMedlem sedan mars 2001290 inlägg okej..
tblUser: (tabell med info om användaren)
fldUserId
fldUseName
tblCat: (tabell med de olika kategorierna)
fldCatId
fldCatName
fldCatActive = on/off
tblUserCat: ("relationstabell" som innehåller vilka kateogirer som användaren har valt som aktiv)
fldUserId
fldCatId
fldActive = on/off
hur ser en sql ut som plockar en lista på vilka kategorier som är vald som aktiv av användaren?
LarsGMedlem sedan dec. 200012 464 inlägg select fldUserName,fldCatName
from tblUser u, tblCat c, tblUserCat uc
where u.fldUserId = uc.fldUserId
and uc.active = 'Yes'
and uc.fldCatId = c.fldCatId
tleeMedlem sedan mars 2001290 inlägg Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] The specified field 'fldUserId' could refer to more than one table listed in the FROM clause of your SQL statement.
select fldCompany, fldUserId
from tblUser u, tblCat c, tblUserCat uc
where u.fldUserId = uc.fldUserId
and uc.fldActive = 'on'
and uc.fldCatId = c.fldCatId;
hmm?
@ndersMedlem sedan juni 200032 969 inlägg I SELECT-delen, specificera vilken tabell du vill hämta fältet ifrån, precis som du gjort i resten av frågan.
tleeMedlem sedan mars 2001290 inlägg ok.. nu får jag ett annat fel.. :)
select tblUser.fldCompany, tblUser.fldUserId from tblUser u, tblCat c, tblUserCat uc where u.fldUserId = uc.fldUserId and uc.fldActive = 'on' and uc.fldCatId = c.fldCatId;
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/t/default.asp, line 79
Peter SMedlem sedan dec. 20025 483 inlägg select u.fldCompany, u.fldUserId
from tblUser u, tblCat c, tblUserCat uc
where u.fldUserId = uc.fldUserId
and uc.fldActive = on
and uc.fldCatId = c.fldCatId;