Hi everyone
I am a newbie in sql statement, and I am trying to extract data from a sql database in sql 2000.
when i try to excute the sql code below it completely drains my hard drive from 80 gb to 0 and the i never could extract the data at all.
Can anyone help me out please, i am competely confused now.
*************************
SQL code
********************
SELECT DISTINCT tblItem.itId AS Expr1, tblLegalStatus.lsName, tblItemLettingPeriod.ilpIsBondLodgedRTBA, tblItemLettingPeriod.ilpCreatedDate,
tblItemLettingPeriod.ilpWeeklyRent, tblItemLettingPeriod.ilpTimesViewed, tblItem.itLeaseable, tblItem.IsAssignment, tblItemType.ittName,
tblSuburb.subName, tblSuburb.subMin, tblSuburb.subMax, tblSuburb.subAvg, tblStayLength.stayName, tblItemLettingPeriod.ilpApprovalDate,
tblItemLettingPeriod.ilpExpiryDate, tblHousingType.htName, tblItemLettingPeriod.ilpStartDate
FROM tblItem INNER JOIN
tblLegalStatus ON tblItem.lsId = tblLegalStatus.lsId INNER JOIN
tblItemLettingPeriod ON tblItem.itId = tblItemLettingPeriod.itID INNER JOIN
tblItemType ON tblItem.ittId = tblItemType.ittId INNER JOIN
tblStayLength ON tblItemLettingPeriod.stayId = tblStayLength.stayId INNER JOIN
tblHousingType ON tblItem.htId = tblHousingType.htId CROSS JOIN
tblSuburb
GROUP BY tblItem.itId, tblLegalStatus.lsName, tblItemLettingPeriod.ilpIsBondLodgedRTBA, tblItemLettingPeriod.ilpCreatedDate,
tblItemLettingPeriod.ilpWeeklyRent, tblItemLettingPeriod.ilpTimesViewed, tblItem.itLeaseable, tblItem.IsAssignment, tblItemType.ittName,
tblHousingType.htName, tblItemLettingPeriod.ilpExpiryDate, tblItemLettingPeriod.ilpApprovalDate, tblStayLength.stayName, tblSuburb.subAvg,
tblSuburb.subMax, tblSuburb.subMin, tblSuburb.subName, tblItemLettingPeriod.ilpStartDate
HAVING (tblItemLettingPeriod.ilpStartDate BETWEEN CONVERT(DATETIME, '2008-07-01 00:00:00', 102) AND CONVERT(DATETIME, '2008-12-31 00:00:00', 102))
I am a newbie in sql statement, and I am trying to extract data from a sql database in sql 2000.
when i try to excute the sql code below it completely drains my hard drive from 80 gb to 0 and the i never could extract the data at all.
Can anyone help me out please, i am competely confused now.
*************************
SQL code
********************
SELECT DISTINCT tblItem.itId AS Expr1, tblLegalStatus.lsName, tblItemLettingPeriod.ilpIsBondLodgedRTBA, tblItemLettingPeriod.ilpCreatedDate,
tblItemLettingPeriod.ilpWeeklyRent, tblItemLettingPeriod.ilpTimesViewed, tblItem.itLeaseable, tblItem.IsAssignment, tblItemType.ittName,
tblSuburb.subName, tblSuburb.subMin, tblSuburb.subMax, tblSuburb.subAvg, tblStayLength.stayName, tblItemLettingPeriod.ilpApprovalDate,
tblItemLettingPeriod.ilpExpiryDate, tblHousingType.htName, tblItemLettingPeriod.ilpStartDate
FROM tblItem INNER JOIN
tblLegalStatus ON tblItem.lsId = tblLegalStatus.lsId INNER JOIN
tblItemLettingPeriod ON tblItem.itId = tblItemLettingPeriod.itID INNER JOIN
tblItemType ON tblItem.ittId = tblItemType.ittId INNER JOIN
tblStayLength ON tblItemLettingPeriod.stayId = tblStayLength.stayId INNER JOIN
tblHousingType ON tblItem.htId = tblHousingType.htId CROSS JOIN
tblSuburb
GROUP BY tblItem.itId, tblLegalStatus.lsName, tblItemLettingPeriod.ilpIsBondLodgedRTBA, tblItemLettingPeriod.ilpCreatedDate,
tblItemLettingPeriod.ilpWeeklyRent, tblItemLettingPeriod.ilpTimesViewed, tblItem.itLeaseable, tblItem.IsAssignment, tblItemType.ittName,
tblHousingType.htName, tblItemLettingPeriod.ilpExpiryDate, tblItemLettingPeriod.ilpApprovalDate, tblStayLength.stayName, tblSuburb.subAvg,
tblSuburb.subMax, tblSuburb.subMin, tblSuburb.subName, tblItemLettingPeriod.ilpStartDate
HAVING (tblItemLettingPeriod.ilpStartDate BETWEEN CONVERT(DATETIME, '2008-07-01 00:00:00', 102) AND CONVERT(DATETIME, '2008-12-31 00:00:00', 102))