目前,我有一个查询,使用多个字段进行用户输入,以便根据输入的输入提取特定产品。目标是让用户输入多个分析物,其中包含他们正在搜索的相应形式,矩阵和浓度,以及用于填充包含全部或至少一个的批号的查询。现在我能够做到这一点,但我想要对结果进行分层,以便最佳匹配搜索条件的结果设置在顶部,并从那里下降,以获得最小的相关结果。我已经尝试在整个谷歌搜索并观看了多个视频,但似乎无法弄明白。任何帮助是极大的赞赏。我是新手,所以如果我的术语不符合标准,我会道歉。我已经发布了下面的SQL代码,并在需要时提供任何其他信息。
SELECT [MASTER PROMO].ID,
[MASTER PROMO].Lot,
[MASTER PROMO].[Exp Date],
[MASTER PROMO].Analyte,
[MASTER PROMO].Unit,
[MASTER PROMO].Matrix,
[MASTER PROMO].Form,
[MASTER PROMO].Concentration
FROM [MASTER PROMO]
WHERE ((([MASTER PROMO].Analyte) Like "*" & Forms![Multi-Analyte Search Form]!Analyte1 & "*" Or
([MASTER PROMO].Analyte)=Forms![Multi-Analyte Search Form]!Analyte2 Or
([MASTER PROMO].Analyte)=Forms![Multi-Analyte Search Form]!Analyte3 Or
([MASTER PROMO].Analyte)=Forms![Multi-Analyte Search Form]!Analyte4) And
(([MASTER PROMO].Matrix) Like "*" & Forms![Multi-Analyte Search Form]!Matrix1 & "*" Or
([MASTER PROMO].Matrix)=Forms![Multi-Analyte Search Form]!Matrix2 Or
([MASTER PROMO].Matrix)=Forms![Multi-Analyte Search Form]!Matrix3 Or
([MASTER PROMO].Matrix)=Forms![Multi-Analyte Search Form]!Matrix4) And
(([MASTER PROMO].Form) Like "*" & Forms![Multi-Analyte Search Form]!Form1 & "*" Or
([MASTER PROMO].Form)=Forms![Multi-Analyte Search Form]!Form2 Or
([MASTER PROMO].Form)=Forms![Multi-Analyte Search Form]!Form3 Or
([MASTER PROMO].Form)=Forms![Multi-Analyte Search Form]!Form4) And
(([MASTER PROMO].Concentration) Like "*" & Forms![Multi-Analyte Search Form]!Concen1 & "*" Or
([MASTER PROMO].Concentration)=Forms![Multi-Analyte Search Form]!Concen2 Or
([MASTER PROMO].Concentration)=Forms![Multi-Analyte Search Form]!Concen3 Or
([MASTER PROMO].Concentration)=Forms![Multi-Analyte Search Form]!Concen4));