开发者

Select Match column from Difference Table

开发者 https://www.devze.com 2023-02-10 12:17 出处:网络
Trying to get title for filtered result POS club title and Item Title Filtered record where match memberid and between two date

Trying to get title for filtered result POS club title and Item Title Filtered record where match memberid and between two date

Here is my table structure

tblPosClub

tblClub

  • ClubID
  • ClubTitle
  • ClubDesc

tblItem

  • ItemID
  • StoreID
  • ItemTitle
  • ItemDesc
  • ItemQuantity
  • ItemPrice

I wishing to retrieve

      * 
 From tblPosClub
Where (tblPosClub.MemberID = @Memberid) 
  AND (tblPosClub.PosClubDate >= @AfterDate) 
  AND (tblPosClub.PosClubDate < @BeforeDate)

...and tblClub.ClubTitle + tblItem.ItemTitle which match according filtered row may i know what should i modify with this sql command ?

    SELECT tblPosClub.PosClubID, 
           tblPosClub.ClubID, 
           tblPosClub.MemberID, 
           tblPosClub.ItemID, 
           tblPosClub.ItemQuantity, 
           tblPosClub.ItemTotal, 
           tblPosClub.PosClubDate, 
           tblClub.ClubTitle, tblItem.ItemTitle
      FROM tblPosClub 
CROSS JOIN tblClub 
CROSS JOIN tblItem
     WHERE (tblPosClub.MemberID = @Memberid) 
       AND (tblPosClub.PosClubDate >= @AfterDate) 
       AND (tblPosClub.PosClubDate < @BeforeDate)

Thx in Advance =D


Use a INNER JOIN

FROM tblPosClub INNER JOIN tblClub
    ON tblPosClub.ClubID = tblClub.ClubID
  INNER JOIN tblItem
    ON tblPosClub.ItemID = tblItem.ItemID

For more information on various join types, see Wikipedia

0

精彩评论

暂无评论...
验证码 换一张
取 消