ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zoran Avtarovski <zo...@sparecreative.com>
Subject Re: What is wrong with this SQL statement
Date Mon, 06 Mar 2006 11:41:14 GMT
What DB are you using? I've found out the hard way that if you don't use
correct ANSI syntax you can get unexpected results. Try changing the
statement from a  join to a inner join like:

FROM (ITEM I inner join PRODUCT P on P.PRODUCTID =  I.PRODUCTID)

Or even better get rid of the parenthesis.

Z.

> <select id="getItemListByCategory" resultClass="item"
> parameterClass="string" cacheModel="itemCache">
>     SELECT
>       ITEMID,
>       LISTPRICE,
>       UNITCOST,
>       SUPPLIER AS supplierId,
>       I.PRODUCTID AS "product.productId",
>       NAME AS "product.name",
>       DESCN AS "product.description",
>       CATEGORY AS "product.categoryId",
>       STATUS,
>       ATTR1 AS attribute1,
>       ATTR2 AS attribute2,
>       ATTR3 AS attribute3,
>       ATTR4 AS attribute4,
>       ATTR5 AS attribute5
>     FROM (ITEM I join PRODUCT P on P.PRODUCTID =
> I.PRODUCTID)
>     where P.CATEGORY = #value#
>   </select>
> 



Mime
View raw message