Hi guys
I would like to have a SQL query to couple  five tables to accomplish my need.
This is a search page and the user will be searching using the don_id
Presently I am using a simple equi join which works fine if all the five 
tables contain data for user_id
But if any of the tables have no value for that particular don_id, it is 
obvious that nothing is being displayed.


I think that a left join will be better but can't get one to display 
results from all the five tables
And the don_id is not unique in the claim table.
So claim table can have same don_id any number of times, I would like to 
display all the claim details for that particular don_id with unique values 
from other tables also.


Here are the tables


1.CREATE TABLE don(don_id char(20) primary key , buy_date date not null) ;
2.CREATE TABLE enduser( user_id char(20) primary key, user_name varchar(50) 
not null, user_addr_str varchar(150), don_id char(20) unique not null, 
pro_pd char(20) unique not null, maker varchar(150), cpu varchar(150)) ;
3.CREATE TABLE usersale(user_sale_id varchar(20) primary key, user_id 
varchar(20) not null, don_id varchar(20) unique not null, pro_pd 
varchar(16) unique not null) ;
4.CREATE TABLE ssale(shit_sale_id varchar(20) primary key, s_id varchar(20) 
not null, don_id varchar(20) unique not null , pro_pd  varchar(16) unique 
not null);
5.CREATE TABLE claim(claim_id int auto_increment primary key, user_id 
varchar(20) not null, don_id varchar(20) not null, pro_pd varchar(20) not 
null, claim_date date not null, claim_det text not null) ;



Note:
Also I may include more tables in the future.I am writing the sql query 
during the runtime by getting field values from the user input through 
check boxes and so I would
prefer to have a single query to do this.


Hope that some of you can help me and thanks in advance
Kayamboo suresh


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to