indentor에서 만든 일정 기간 동안 구매 들여 쓰기를 보여주는 보고서가 있습니다. 여기서 @Name 매개 변수는 들여 쓰기 필터에 사용됩니다. 그러나 문제는 @Name 매개 변수가 비어 있으면 보고서가 null 레코드를 반환한다는 것입니다. @Name 필터에서 아무 것도 선택하지 않으면 모든 들여 쓰기 보고서를 표시하려고합니다. 아래는 쿼리입니다. 나는 SQL에 익숙하지 않다.필터가 NULL 인 경우 모든 레코드를 반환하는 방법 (비어 있음)
SELECT INH.No_, INH.[Approved Date],
INH.Indentor, INL.No_ AS ItemCode,
INL.Description, INL.Description2,
INL.Req_Quantity, INL.[Unit of Measure],
PL.[Document No_], PH.[Order Date], PL.Quantity AS OrderedQuantity, PL.[Quantity Received]
FROM [Company$Indent Header] AS INH
INNER JOIN
[Company$Indent Line] AS INL
ON INH.No_ = INL.[Document No_]
INNER JOIN
[Company$Purchase Line] AS PL
ON INL.[Document No_] = PL.[Indent No_] AND INL.[Line No_] = PL.[Indent Line No_]
INNER JOIN
[Company$Purchase Header] AS PH
ON PL.[Document No_] = PH.No_
WHERE (INH.Indentor = @Name) AND (INL.No_ <> '') AND
(INH.[Approved Date] BETWEEN @StartDate AND @EndDate)
ORDER BY ItemCode
유 시도했다. – highwingers
또는 @Name는 널 (null)이 될 수있는 매개 변수를 확인 할 수있는 저장 기능을 가진 어쩌면 – highwingers
널입니다 :
–