By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,872 Members | 2,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,872 IT Pros & Developers. It's quick & easy.

how to display records from multiple tables

P: 20
im having 2 tables
1.tbla_can_types(containing type_id,type_name,fac_id)
2.tbla_canteen_rates(containing fac_id,cat_id,type_id,from_time,to_time...)
this table is empty.

in the load page i display records using existing database

now i want only typenames row to be displayed and rest of the rows should be empty.

i have left join method but its not working when im inserting records into tbla_canteen_rates table data is reflected to all cat_id's

to dispaly the typenames which are not present in the tbla_canteen_rates

select type_name from tbla_can_types where fac_id=$fac_id and type_id not in(select type_id from tbla_canteen_rates where fac_id=$fac_id and cat_id=$cat_id)

please tell me the logic how to do that.

thank you
Attached Files
File Type: doc load page.doc (28.5 KB, 184 views)
File Type: doc screen.doc (70.5 KB, 152 views)
Jan 5 '12 #1
Share this Question
Share on Google+
5 Replies

Expert Mod 10K+
P: 12,364
I don't understand what you're trying to achieve. Sample data and results would help.
Jan 5 '12 #2

P: 20
please check the attached document(load page)
Jan 6 '12 #3

Expert Mod 10K+
P: 12,364
That doesn't tell me what I want to know.
Jan 6 '12 #4

P: 20
if u see the screen the in the first row type names are display(which is coming from tbla_can_types_phani)and rest r from tbla_canteen_rates_phani

now i want only typenames should be displayed on every change of fac_id & cat_id ,rest should be empty(as there is no data in it)


select type_name from tbla_can_types where fac_id=$fac_id and type_id not in(select type_id from tbla_canteen_rates_phani2 where fac_id=$fac_id and cat_id=$cat_id);

ans:this query returns type_names which are not present in tbla_canteen_rates2(empty table)

name from_time to_time





only type_names should be displayed remaining cells should be empty .

if i use left join im getting it but when i enter records it will reflect on every cat_id of type_name(suppose cat_id=12 it has 4 type_id's if i insert type_name(BREAK FST) it is inserted on every cat_id of corresponding type_id and fac_id.

select e1.type_name,e2.from_time,e2.to_time,e2.rate,e2.of f_rate,e2.status,to_char(e2.effective_date,'dd-Mon-yyyy') from tbla_can_types e1 LEFT JOIN tbla_canteen_rates2 e2 ON e1.type_id=e2.type_id where e1.fac_id=1 order by e1.type_id
Jan 6 '12 #5

Expert Mod 10K+
P: 12,364
You've already explained, or attempted to explain what you want. And I have trouble understanding your explanation. I said I wanted to see sample data and results.
Jan 6 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.