I'm trying to make two select
queries so that second selection have to based on first. I give first table name "t1" and try to make second selection based on first but finally i get database error.
SQL
SELECT startpoli_i ,
finalpoli_i ,
prosfora ,
comments_pro ,
accepted ,
onoma01 ,
epitheto01 ,
email01 ,
tilefono01 ,
weight1 ,
depdate1 ,
specialservices1 ,
comments1 ,
username01
FROM (offers ,registration1 ,customer) t1
WHERE (
offers.string_uniq regexp concat( :str)
AND registration1.username01 = offers.user_i
AND customer.startpoli1 = offers.startpoli_i
AND customer.finalpoli1 = offers.finalpoli_i )
UNION
SELECT startpoli_i ,
finalpoli_i ,
prosfora ,
comments_pro ,
accepted ,
onoma01 ,
epitheto01 ,
email01 ,
tilefono01 ,
weight1 ,
depdate1 ,
specialservices1 ,
comments1 ,
username01
FROM offers ,
registration1 ,
customer
WHERE offers.startpoli_i = t1.startpoli_i
AND offers.finalpoli_i = t1.finalpoli_i
I am pretty sure that error has to do with how i use table name t1. Any suggestion;