[PHP-DB] Re: difficult sql statement. Help needed

2002-04-10 Thread Lutz Brückner
Hi Andy, > There are 3 tables: provinces, cities, countries > The result should be city, province, country but only if province is > available. If not just display city and country.! > > Lets say we are searching for madrid. > > I did build following statement: > SELECT c.city, c.ID, p.pro

[PHP-DB] Re: difficult sql statement. Help needed

2002-04-10 Thread phplists
The above post may be unclear.. What he did was used if() statements to compare whatever and generate the query differently based on what he found.. $lotsOdata = $database->result( "SELECT * FROM someTable" ); $count = mysql_num_rows( $lotsOdata ); while( $count > 0 ) { if( $lotsOdata[city] !

RE: [PHP-DB] Re: difficult sql statement. Help needed

2002-04-10 Thread Kevin Bucknum
You need to look up LEFT JOIN in the documention of the database you are using. > > "Andy" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi there, > > > > I do have a sql statement where I could need some help on. > > > > There are 3 tables: provinces

[PHP-DB] Re: difficult sql statement. Help needed

2002-04-10 Thread phplists
I don't know that I could help much with your statement.. But you mentioned doing if() statements in SQL queries.. Well, my programmer always writes them into PHP scripts then just runs them from there.. Then he can include if() conditions, or whatever else he needs.. Just a quick little cust_impo