Subject:Use of if-then-else Author:Raghav Tulshibagwale Date:18 Nov 2008 01:49 AM Originally Posted: 18 Nov 2008 01:47 AM
Hello ...
I have the following query which is giving me an error. The problem comes when I put the "if-then-else" statements there!! Can any one of you put some light on it??
The query is as follows....
let $customer :=doc("cust.xml")/cust_information/cust
let $mall :=doc("mall.xml")/mall_information/mall
for $cust in $customer
let $x := count ((for $temp in $mall where $temp/mall_cust = $cust/cust_id and $temp/mall_addr = "Main street" return $temp) )
let $y := count ((for $temp in $mall where $temp/mall_cust = $cust/cust_id and $temp/mall_addr = "downtown" return $temp) )
if ($x < $x )
then return $cust/cust_id
else()
This query is intended to return all customers who go to mall on "main street" MORE THAN mall at "Downtown". This query gives errors!!