Hi,
I'm trying to execute the following SQL statement:
Code:
SELECT d, p.price
FROM StateDestinationData sd, DestinationData d, OfferData o,
PackageData p
WHERE sd.stateId = "+stateId+" AND sd.destId = d.destId AND
d.destId = o.destId AND o.offerId = p.offerId "
p.price = (SELECT min(price)
FROM PackageData WHERE offerId = o.offerId)
ORDER BY d.destName ASC
but am getting the following error:
Code:
com.cendant.trg.getaways.common.TRGDatabaseException: Error in findDestsWithPkgPrice():net.sf.hibernate.QueryException: undefined alias: price [SELECT d, p.price FROM com.cendant.trg.getaways.model.StateDestinationData AS sd, com.cendant.trg.getaways.model.DestinationData AS d, com.cendant.trg.getaways.model.OfferData AS o, com.cendant.trg.getaways.model.PackageData AS p WHERE sd.stateId = 8 AND sd.destId = d.destId AND d.destId = o.destId AND o.offerId = p.offerId p.price = (SELECT min(price) FROM com.cendant.trg.getaways.model.PackageData WHERE offerId = o.offerId) ORDER BY d.destName ASC]
at com.cendant.trg.getaways.db.DestinationDAO.findDestsWithPkgPrice(DestinationDAO.java:105)
at com.cendant.trg.getaways.db.test.DestinationDAOTest.testDestinationSelect(DestinationDAOTest.java:57)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
Help please!!!