I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
SELECT Tabel.Bid, Tabel.Tal, Tabel_1.Tal FROM Tabel AS Tabel_1 INNER JOIN Tabel ON Tabel_1.Bid = Tabel.Bid WHERE (((Tabel.Bid)=1) AND ((Tabel.Tal)=1) AND ((Tabel_1.Tal)=2));
Tag din tabel ind i forespørgslen 2 gange og sæt så det ger ind.
Efter jeg har nærlæst spørgsmålet, er sagen denne: Vi skal finde alle der har både 1 og 2 i tal ikke 1 eller 2 Jeg tror kun at det kan gøres på min måde
Jeg mener nu også denne fungerer. Den eneste forskel fra mit tidligere svar er, at jeg har tilføjet feltet BrugerID. Den er afprøvet og så vidt jeg kan se fungerer den:
SELECT Tabel1.BrugerID, Tabel1.BId, Tabel1.tal FROM Tabel1 WHERE (((Tabel1.BId)=1) AND ((Tabel1.tal)=2));
select bid from table1 AS a where tal = 1 and exists ( select bid from table1 AS b where a.bid = b.bid and b.tal = 2)
what is happening is that a select is made on table1 and the table gets the alias name (a) then another select is made where table1 gets the alias (b) You can use AS but it is not necessary.
and exists instead of exists.
So gkn2000 all you should need to do is replace the table name (table1) to th ecorrect name of the table and it should work.
gkn2000>Are you 100%sure that teh accepted answer (SELECT Tabel1.Bid, Tabel1.nr FROM Tabel1 WHERE (((Tabel1.Bid)=1) AND ((Tabel1.nr)=1 Or (Tabel1.nr)=2));)
gkn2000 try this! The accpeted answer DOES NOT work! It only works because the SQL includes WHERE (((Tabel1.Bid)=1) and the data happens to be correct for this query Add another record for BID = 2 and tal = 2 then it will NOT be inclluded in the result
SELECT Tabel1.Bid, Tabel1.nr FROM Tabel1 WHERE ((Tabel1.nr)=1 Or (Tabel1.nr)=2));
Hej terry, Nu har jeg prøvet din forslag og hvis du nærlæser mit spørgsmål skal jeg kun bruge de/den record hvor både tal 1 og tal 2 er i. Ikke dem hvor een af dem er. Og Or betyder eller! does it not???
Hej kabbak, Jeg ved godt at du har svarat men hvad gør jeg hvis jeg også vil have 'tal' 3 med altså både 1 og 2 og 3. Kan man det???
gkn2000 thats exactly what SELECT DISTINCT Table1.Bid, DCount("Bid","Table1"," Bid = " & [bid] & " AND( tal=1 or tal = 2)") AS cnt FROM Table1 WHERE (((DCount("Bid","Table1"," Bid = " & [bid] & " AND( tal=1 or tal = 2)"))=2));
IT DOES! It gives you ONE bid which has tal=1 AND tal=2
SELECT Tabel.Bid, Tabel.Tal, Tabel_1.Tal, Tabel_2.Tal FROM Tabel AS Tabel_2 INNER JOIN (Tabel AS Tabel_1 INNER JOIN Tabel ON Tabel_1.Bid = Tabel.Bid) ON Tabel_2.Bid = Tabel.Bid WHERE (((Tabel.Bid)=1) AND ((Tabel.Tal)=1) AND ((Tabel_1.Tal)=2) AND ((Tabel_2.Tal)=3));
Det er simpelthen for dumt. Her kommer man med det korrekte svar på spørgsmålet og en anden, som kommer med en eller anden feeble-løsning løber med pointene, fordi spørgeren ikke er i stand til at vurdere svaret korrekt. Der røg min interesse i at hjælpe her på eksperten.
Which I happened to correct some 37 seconds later, and which shouldnt be any problem for anyone with just a remote knowledge of SQL. Nevermind, my statement still stands. This sucks !
Terry > jeg havde ikke set din kommentar fra kl. 18:49:18, det er rigtig jeg søger ikke på alle "Bid", jeg havde stadigvæk ikke læst spørgsmålet rigtig.
Så hvis i ( terry og arnvig ) vil have nogle point, kan i få nogle af mig.
No, Terry, it wouldnt help if you gave me all of your points. (Or any of Kabbaks) Its not the points , its the principle. I hate it when you take the time to come up with the right answer, and the people asking, dont give a s**t. The points are a symbol that says: "You came up with an answer, when I needed it, Thanx". People should be more carefull how they award points.
arnvig>I understand FULLY, I too have been in the very same boat MANY times. But just to support gkn2000 (a little) take a look at the comment he placed Kommentar: gkn2000 08/01-2003 17:48:12
He is NOT sure how to use this query and thats why I place a coment later (tying) to explain!
Terry: No wonder the IT business is running like hell. All the kids are out there coding, and all the experts are out of work, passing time by helping all the kids. geees, guees i wanna be an orca in my next life.
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.