Am Mittwoch, 19. März 2008 schrieb dirk:
> Hello,
>
> first let me say sorry about my bad english, i'll do my best.
>
> Ok, i create a search form to select datasets from a sqlite3 database,
> my form use this query: / WHERE (( "table1"."land" = "table2"."land" )) /
> it works very fine as long as /"table2"."land"/ isn't empty. If
> /"table2"."land" /is empty i get no results, that's ok, because
> /"table1"."land"/ is never empty.
> My problem is that i need a value for /"table2"."land"/  to show all
> datasets from /"table1" /
> I try the placeholders "*" and "?" but it don't work
This is the normal behavior of a SQL-database and you can't resolve it using 
placeholders. The solution is to create a complexer query. I don't know much 
about sqlite3 but you should look for the syntax of joins because they will 
be your friends. Asuming that table1 always has a value and table2 is lacking 
some of the values table1 has, in Postgresql the syntax for your query would 
be:
SELECT table1.land AS land1, table2.land AS land2 FROM table1 LEFT JOIN table2 
ON table1.land = table2.land;

In case in one of the table some of the values apear more then once you should 
do:
SELECT DISTINCT table1.land AS land1, table2.land AS land2 FROM table1 LEFT 
JOIN table2 ON table1.land = table2.land;

(of course you can complete this with an ORDER BY - phrase.)

Regards,
Michael

>
> Greetings Dirk
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Hk-classes-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Hk-classes-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss

Reply via email to