0

I have two tables in my SQL Server database. The first is bidder_interest_name and second is tender_type_subcat . There have multiple value column bidder_interest_subcategory in bidder_interest_name and tender_type_subcategory in tender_type_subcat tables.

Now I want to select the multiple values from both the tables for a particular subcategory and need to both table minimum matching value.

This is what I'm doing

What I have tried:

SELECT bi.bidder_interest_subcategory,tt.tender_type_subcategory 
FROM bidder_interest_list as bi,new_tender_two as tt 
WHERE bi.bidder_id=$bidder_id
5
  • use join query @illesh Commented May 10, 2016 at 6:48
  • Please post your tries Commented May 10, 2016 at 6:48
  • SELECT bi.bidder_interest_subcategory,tt.tender_type_subcategory FROM bidder_interest_list as bi,new_tender_two as tt WHERE bi.bidder_id=$bidder_id Don't work Commented May 10, 2016 at 6:49
  • Do the tables relate (to one another) in some way? And note that SQL server is not MySQL Commented May 10, 2016 at 6:59
  • Possible duplicate of How can an SQL query return data from multiple tables Commented May 10, 2016 at 7:06

2 Answers 2

1

Try this

SELECT bi.bidder_id, bi.bidder_interest_subcategory,tt.tender_type_subcategory FROM bidder_interest_list as bi,new_tender_two as tt WHERE bi.bidder_id=$bidder_id;
Sign up to request clarification or add additional context in comments.

1 Comment

yes but i have two table same value i check this var_dump but output is NULL
0

Try this :SELECT bi.bidder_id=tt.tender_id, bi.bidder_interest_subcategory,tt.tender_type_subcategory FROM bidder_interest_list as bi,new_tender_two as tt WHERE bi.bidder_id=bidder_id;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.