제가 원하는 화면은..
날짜               예상내역     예상금액   실내역         실금액 . . . 
----------------------------------------------------------
2002-12-04      택배비        20000        식비           10000
2002-12-05      관리비        10000
2002-12-06                                      5000
이런식으로 나오는 건데요..
근데 12-04일에 예상내역만 입력하고 
12-05일에는 실내역만 입력하면..
위의 화면처럼 그 날짜에 해당하는것만 나와야 하는데..
지금 나오는 화면은..
날짜               예상내역     예상금액   실내역         실금액 . . . 
----------------------------------------------------------
2002-12-04      택배비        20000        식비           10000
2002-12-06      관리비        10000        5000
.
.
이렇게 뒤에 있는 날짜의 데이터랑 합쳐져 버리거든요..
쿼리가 잘못된건지..뭔지..잘 모르겠어요..
참고로..소스는요...
procedure TFrmSearch.GetDatePrice(SearchDate : String);
var
    Gubun1,Gubun2,Gubun3,Gubun4,RowCnt : Integer;
    TotPrice : Array[0..1] Of Integer;
    Comp_Date, DayPrice_temp : String;
begin
    rowcnt:=0;
    Gubun1 := 0;
    Gubun2 := 0;
    Gubun3 := 0;
    Gubun4 := 0;
    TotPrice[0] := 0;
    TotPrice[1] := 0;
    With DataModule1.Query Do
    begin
        Close;
        SQL.Clear;
        SQL.Add('SELECT A.PriceCode,A.Gubun_Code, A.Price, A.Price_Date, B.Code_Name');
        SQL.Add(' From Tb_PricePlan A, Tb_PriceCode B');
        SQL.Add(' where A.PriceCode=B.PriceCode and Price_Date in (');
        SQL.Add(' SELECT Price_Date FROM Tb_PricePlan');
        SQL.Add(' where Price_Date Like ''2002-11%'' Group By Price_Date)');
        SQL.Add(' Order by a.Price_Date, a.Gubun_Code');
        Open;
        While Not EOF Do
        Begin
            Case FieldByName('Gubun_Code').AsInteger of
                0 : begin
                        Inc(Gubun1);
                        SearchGrid.Cells[0,Gubun1] := FieldByName('Price_Date').AsString;
                        SearchGrid.Cells[1,Gubun1] := FieldByName('Code_Name').AsString;
                        SearchGrid.Cells[2,Gubun1] := FieldByName('Price').AsString;
                        HiddenGrid.Cells[0,Gubun1] := FieldByName('PriceCode').AsString;
                        HiddenGrid.Cells[1,Gubun1] := FieldByName('Price').AsString;
                    end;
                1 : begin
                    Inc(Gubun2);
                    SearchGrid.Cells[0,Gubun2] := FieldByName('Price_Date').AsString;
                    SearchGrid.Cells[3,Gubun2] := FieldByName('Code_Name').AsString;
                    SearchGrid.Cells[4,Gubun2] := FieldByName('Price').AsString;
                    TotPrice[0] := TotPrice[0] + FieldByName('Price').AsInteger;
                    HiddenGrid.Cells[0,Gubun2] := FieldByName('PriceCode').AsString;
                    HiddenGrid.Cells[2,Gubun2] := FieldByName('Price').AsString;
                end;
                2 : begin
                    Inc(Gubun3);
                    SearchGrid.Cells[0,Gubun3] := FieldByName('Price_Date').AsString;
                    SearchGrid.Cells[5,Gubun3] := FieldByName('Code_Name').AsString;
                    SearchGrid.Cells[6,Gubun3] := FieldByName('Price').AsString;
                    HiddenGrid.Cells[0,Gubun3] := FieldByName('PriceCode').AsString;
                    HiddenGrid.Cells[3,Gubun3] := FieldByName('Price').AsString;
                end;
                3 : begin
                    Inc(Gubun4);
                    SearchGrid.Cells[0,Gubun4] := FieldByName('Price_Date').AsString;
                    SearchGrid.Cells[7,Gubun4] := FieldByName('Code_Name').AsString;
                    SearchGrid.Cells[8,Gubun4] := FieldByName('Price').AsString;
                    TotPrice[1] := TotPrice[1] + FieldByName('Price').AsInteger;
                    HiddenGrid.Cells[0,Gubun4] := FieldByName('PriceCode').AsString;
                    HiddenGrid.Cells[4,Gubun4] := FieldByName('Price').AsString;
                end;
            end;
            Inc(rowcnt);
            DayPrice_temp := IntToStr(TotPrice[0]-TotPrice[1]);
            SearchGrid.Cells[9,rowcnt] := DayPrice_temp;
            Next;
        End;
    End;
end;
이거거든요..
아시는분 어떻게 해야 할지 알려주세요~
그리고 하나 더 물어보자면..
이부분이요..
        SQL.Add(' where Price_Date Like ''2002-11%'' Group By Price_Date)');
이거를 Price_Date Like :Price_Date
이렇게 쓰면 에러가 나서 일단 저렇게 한건데요..
머가 잘못됐는지 좀 알려주세요~
(__)
			 
	
	
    
    
	
	
    
    
    
12-16일자가 12-15일자 위에 덮어 쓰는것 같은데요..
확실한 문제를 보고 싶으시면 먼저 쿼리를 DB그리드 컴포나 아닌 디비에서 먼저 돌려보심 결과가 확실해 질 겁니다.
그리고 아래 파라메터..테스트에서 전 잘되는군요.
혹 쿼리다음 오픈전에
query1.ParamByName('Price_Date').asstring := '2002-11%';
를 빼먹으신게 아니신지..아니라면 에러메세지를 올려주심이 나을 겁니다.
그럼, 즐코...