Hi
I changed from mysql 3.23.49 -nt to 4.0.2 max to make use of union
But one problem when trying to join tables is that UNION works only for
SELECT queries with same number of coulmns. Is there any way to join 3 or
more tables having different columns using UNION? I am writing my query
during the runtime. Since the user can select any number of fileds from a
particular table and also I am using LEFT JOIN, I can't make all the tables
having same number of fields.
Thanks for any help
------------------------------------------------------------------------------
Hi
I would like to have a SQL query to couple all the 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
But since the don_id is not unique in the claim table, I don't know how to
display this
Also since the 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
Note:
Also I may include more tables in the future.I am writing the sql query
during the runtime by getting values from the user input and so I would
prefer to have a single query to do this.
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) ;
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------