tags:

views:

10

answers:

0

Hello. I'm totally blank about sql, but im have to make sql query in OO Base. Query have to avoid compare, when cell in table "Search" is blank. My code dont work. I hope somebody will help me.

     SELECT "D"."Name", "D"."SName", "D"."Date of", "D"."Type", "D"."Place", "D"."Unit1", "D"."Unit2" 

    FROM "Data" AS "D", "Search" AS "S" 

    WHERE (( "D"."Name" = "S"."Name" ) OR ( "D"."Name" = '%' )) AND (( "D"."SName" = "S"."Sname" ) OR ( "D"."Sname" = '%' )) 

AND ( "D"."Date of" BETWEEN "S"."Date1" AND "S"."Date2" ) AND (( "D"."Type" = "S"."Type" ) OR ( "D"."Type" = '%' )) 
AND (( "D"."Place" = "S"."Place" ) OR ( "D"."Place" = '%' )) AND (( "D"."Unit1" = "S"."Unit1" ) OR ( "D"."Unit1" = '%' )) 
AND (( "D"."Unit2" = "S"."Unit2" ) OR ( "D"."Unit2" = '%' ))