Avatar billede mike@work Praktikant
19. december 2001 - 15:10 Der er 11 kommentarer og
1 løsning

Nested SQL opdatering !

Jeg ville meget gerne opdatere min tabel med en simpel forspørgelse, så som:

UPDATE Bookmarks SET Bookmarks.Bookmark_accessed = (SELECT bookmark_accessed FROM bookmarks WHERE bookmark_id = 1)+1, Bookmarks.Bookmark_lastaccess = Now()
WHERE Bookmarks.Bookmark_id = 1

Men får en rigtig god fejl der siger: \"Operation must use an updateable query.\".... Dvs. der er ingen måde hvorpå jeg kan gøre dette eller skal man bare snyde lidt ?!?!?
Avatar billede terry Ekspert
19. december 2001 - 15:16 #1
Try changing the nested select to a dlookup!
Avatar billede terry Ekspert
19. december 2001 - 15:18 #2
Have you made the query in the query builder? You can select th equery type form a little mney button in the menu. Then you can see if you can get this query to work there!

Avatar billede terry Ekspert
19. december 2001 - 15:18 #3
mney  = menu
Avatar billede mike@work Praktikant
19. december 2001 - 15:23 #4
Ehhh Don\'t follow you.... The SQL statment is handmade, and I\'m not comfitable to let Access mess up my SQL statment....

Can you bee more specific or give an example ?!?!?
Avatar billede terry Ekspert
19. december 2001 - 15:24 #5
I can take a look at the dB if you like and then you can see how its done!
Avatar billede terry Ekspert
19. december 2001 - 15:27 #6
You dont need to change you rSQL until you know it is working. Copy and paste your SQL into the Access query designer. Then once you can see its working there you replace your original SQL with the new.
Avatar billede mike@work Praktikant
19. december 2001 - 15:29 #7
I\'m using the database for an intranet - So I need an SQL statment that in one and single line can update the bookmark table so that [accessed] is one plus last value....

Two tables:

[Emplyees]
Id
Name

[Bookmarks]
Id
Name
Url
Accessed
LastAccess
Avatar billede terry Ekspert
19. december 2001 - 15:39 #8
UPDATE Bookmarks SET Bookmarks.Accessed = [Accessed]+1, Bookmarks.LastAccess = Now();

These names are NOT the same as your query, but from the tables mentioned on your comment 15:29

Avatar billede terry Ekspert
19. december 2001 - 15:40 #9
forgot something:

UPDATE Bookmarks SET Bookmarks.Accessed = [Accessed]+1, Bookmarks.LastAccess = Now()
WHERE (((Bookmarks.ID)=1));
Avatar billede terry Ekspert
19. december 2001 - 15:41 #10
The first SQL updates ALL records, then next only where ID = 1
Avatar billede mike@work Praktikant
19. december 2001 - 16:00 #11
Perfect !!!!
Avatar billede terry Ekspert
19. december 2001 - 16:00 #12
tak :o)
Avatar billede Ny bruger Nybegynder

Din løsning...

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.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester