So I had a hard time finding a good answer on Stack. I'm looking to run a query that combines the information on two tables together. So far this is what i have got. The actual scenario is as follows:
I will try to explain a bit more from my side to achieve this:
I have two tables :
Comparitive_st_sup
___________________
id | tender_id | item_name | slno | supplier_name | prod_description
________________________________________________________________________
1 401 Collinear 1 OnlineMetals Description comes here
2 401 Filter 2 OnlineMetals Description comes here
3 401 Antenna 3 OnlineMetals Description Comes here
4 455 Primer 1 KR Electronics Description comes here
5 455 Chock 2 KR Electronics Description comes here
comparitive_st_tech_compliance
_______________________________
id | tender_id | item_name | slno | supplier_name | tech_analyst_comment
__________________________________________________________________________
1 401 Collinear 1 OnlineMetals 90%
2 401 Filter 2 OnlineMetals 25%
3 401 Antenna 3 OnlineMetals 87%
4 455 Primer 1 KR Electronics 64%
5 455 Chick 2 KR Electronics 80%
Now i am expecting a result like:
401 Collinear 1 OnlineMetals Description comes here 90%
401 Filter 2 OnlineMetals Description comes here 25%
401 Antenna 3 OnlineMetals Description comes here 87%
As per the tender_id selected the value is passing as a querystring and the records has to be displayed accordingly. Help appreciated..
I tried this, but result is not proper:
Select comparitive_st_sup.*,
comparitive_st_sup.tender_id As tender_id1,
comparitive_st_sup.supplier_name As supplier_name1,
comparitive_st_sup.slno As slno1,
comparitive_st_sup.prod_description As prod_description1,
comparitive_st_sup.item_name As item_name1,
comparitive_st_sup.total As total1,
comparitive_st_tech_compliance.tech_analyst_comment
From comparitive_st_tech_compliance
Right Join comparitive_st_sup On comparitive_st_sup.tender_id =
comparitive_st_tech_compliance.tender_id
Where comparitive_st_sup.tender_id = 401
I need to display all the fields from comparitive_st_sup and only one field (tech_analyst_comment) with a where condition tender_id. Now the records are duplicating. Instead of 3 records to show, it is showing 9 records. Am i making any mistake?