Avatar billede idani Praktikant
10. november 2008 - 10:17 Der er 5 kommentarer og
1 løsning

Tabel oversættelse

Hejsa

Jeg har følgende:
Tabel Før 2008
Tabel Efter 2007
Cpr nr.

Tabel Før 2008 - benytter lønnummer som nøgle
Tabel Efter 2008 - benytter cpr som nøgle.
Tabel Cpr nr. Oversætter Lønnummer til Cpr. nummer.

Jeg har så efterfølgende dannet en relation mellem cpr og de andre tabeller, sådan at jeg finder cpr nummeret i cpr. tabellen, denne konveterer så cpr. nr. til lønnummer og finder så posterne i tabel før 2008.
MEN den vil ikke tage posterne med i tabel efter 2008.
Nogen som har nogle gode råd til hvordan jeg får min forspørgsel til at lykkes.
Altså jeg vil gerne have en forspørgsel som tager alle poster på et cpr nummer 
venlig hilsen
IDa Nielsen
Avatar billede terry Ekspert
10. november 2008 - 10:40 #1
An idea would be to add a field (cpr) to the table "Før 2008"  and then run an update query to cpr with the cpr number from tbale CPR.

Example:

UPDATE [Før 2008] SET CPR = (SELECT CPR FROM [CPR] C WHERE C![Lønnummer] = [Før 2008]![lønnummer]


Now you have the cpr number in both tables

You could also do the same for the "Efter 2008" table so that you have "Lønnummer in that too.

Now both your tables should be the same, where you can choose to use either CPR or lønnummer.
Avatar billede terry Ekspert
10. november 2008 - 10:40 #2
you need a closing ) to the UPDATE SQL
Avatar billede idani Praktikant
10. november 2008 - 11:54 #3
Hmm I have thougth of that, but but but - in the futhure I have to import the list to Efter 2008, and I'm not finish importing the list Før 2008.
So an update is not the right choice at the moment.
I'm looking for a solution where the system is to find the cpr. number in the tabel Cpr nr. and if it dosn't have a number there - it just finds it in the tabel efter 2008

Best regards
Ida nielsen
Avatar billede terry Ekspert
10. november 2008 - 12:26 #4
Its difficult to give a solution without really knowing more to what exactly it is your trying to do.

"Altså jeg vil gerne have en forspørgsel som tager alle poster på et cpr nummer"

Are you saying that the same CPR/Lønnummer can be in both tables?

If so then make a UNION SELECT


SELECT .....
UNION
SELECT .....


you cant use query designer to make UNION selects but you can use it to get the SQL right for each seperate SELECT in the UNION select

so first get the select working for [Før 2008] using the CPR table to find the correct CP and then do then make a SELECT for the "EFTER 2008" table.

Just make sure that for each select you have the same number of output fields and with the same type.
You could actually make a query for each of these selects and then make teh UNION select with these..

EG:

SELECT * FROM qyFør2008
UNION
SELECT * FROM qyEfter2008
Avatar billede terry Ekspert
19. november 2008 - 18:13 #5
do you still need help here Ida?
Avatar billede terry Ekspert
17. februar 2009 - 12:07 #6
thanks
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