webForumDet fria alternativet

Access och två tabeller

1 svar · 386 visningar · startad av Pedda

PeddaMedlem sedan juni 20006 032 inlägg
#1

Jag har två tabeller i en Access databas.

project commissioning form
Project_ID
form_code

commissioning form
form_code
title
template_id

Jag har följand query nu:

SELECT [project commissioning form].form_code,  [commissioning form].title, [commissioning form].template_id 
FROM [commissioning form] 
INNER JOIN [project commissioning form] 
ON [commissioning form].form_code = [project commissioning form].form_code 
WHERE [project commissioning form].Project_ID = "P/06050";

Problemet är att tabellen project commissioning form kan innehålla dubletter och jag vill bara ha ut unika, men har ingen koll på hur det funkar i Access.

doggelitoMedlem sedan juni 20003 076 inlägg
#2

En vanlig GROUP BY borde väl funka. :)

SELECT pcf.form_code,  cf.title, cf.template_id 
FROM [commissioning form] cf
INNER JOIN [project commissioning form] pcf ON cf.form_code = pcf.form_code 
WHERE pcf.Project_ID = "P/06050"
GROUP BY pcf.form_code,  cf.title, cf.template_id
135 ms totalt · 3 externa anrop · v20260731065814-full.16f3d68c
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
133 ms — hämta tråd, inlägg och bilagor (db)