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
- PosClubID
- ClubID
- StaffID
- MemberID
- ItemID
- ItemQuanti开发者_高级运维ty
- ItemTotal
- PosClubDate
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
精彩评论