
April 3rd, 2007, 05:34 PM
|
|
Registered User
|
|
Join Date: Apr 2007
Posts: 1
Time spent in forums: 37 m 29 sec
Reputation Power: 0
|
|
|
Really noobish question...
I can't get this final part of the SQL statement, I need to get the MAX date from LotStat.InventoryDate out of this query but I don't want to return the date.
Any one have any ideas??
Code:
SELECT
B.BlockName AS Block,
I.Lot AS Lot,
R.RefCodeName AS LotType,
I.SaleableFrontFootage AS Frontage,
ISNULL(IA.Address + ', ','') + IA.CityName + ' ' + IA.ProvinceCode + ' ' + ISNULL(IA.PostalCode,'') AS Address,
AI.HouseStyle AS Style,
RC.RefCodeName AS Status,
Purch.PurchaserName AS Builder
FROM Inventory AS I
JOIN Block AS B
JOIN Phase AS P
JOIN ProjectSub AS PS
JOIN Project AS PJ
ON PS.ProjectID = PJ.ProjectID
ON P.ProjectSubID = PS.ProjectSubID
ON B.PhaseID = P.PhaseID
ON I.BlockID = B.BlockID
JOIN dbo.InventoryAddressByInventoryID(NULL) IA
ON I.InventoryID = IA.InventoryID
JOIN "User" AS U
ON I.UserID = U.UserID
LEFT JOIN RefCode AS R
ON I.LotTypeRefCodeID = R.RefCodeID
LEFT JOIN Inventory_mm_Purchaser as Builder
ON I.InventoryID = Builder.InventoryID
LEFT JOIN Purchaser as Purch
ON Builder.PurchaserID = Purch.PurchaserID
LEFT JOIN ArchitectureInformation as AI
ON I.InventoryID = AI.InventoryID
LEFT JOIN InventoryDate AS LotStat
ON I.InventoryID = LotStat.InventoryID
LEFT JOIN RefCode AS RC
ON LotStat.RefCodeID = RC.RefCodeID
WHERE PJ.ProjectName = 'Something'
AND P.PhaseID IN (114, 119, 120)
AND Purch.PurchaserName NOT LIKE '%SOMETHING%'
AND RC.RefCodeID IN (67, 71, 73)
Thanks in advance for any help.
Wade
|