Joins query

Results 1 to 2 of 2

Thread: Joins query

  1. #1
    Join Date
    Dec 1969

    Default Joins query

    I have 3 tables..<BR>Project_master(PROJECT_ID,PROJECT_NAME )<BR>PROJECT_DETAILS(PROJECT_ID,DETAILS1,DETAILS2, COUNTRY_ID)<BR>COUNTRY_MASTER(COUNTRY_ID,COUNTRY_N AME)<BR><BR>For ex. If I have details as mentioned below<BR><BR>Project_master<BR>---------------------<BR>Project_id Project_name<BR>1 Testing<BR>2 Quality<BR><BR>Project_details<BR>--------------------------------<BR>Project_id details1 details2 Country_id<BR>1 d1 d2 3<BR>1 d3 d1 4 <BR>2 det1 det5 1<BR>3 d2 d3 2<BR><BR><BR>What I need is a query which will fetch the country_ids from project_details for which project_id is repeated..<BR><BR>Pls help<BR><BR>vals<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Joins query

    I think this is what you wanted:<BR><BR>SELECT country_id FROM project_master m<BR>INNER JOIN project_details d ON m.project_id = d.project_id<BR>GROUP BY country_id<BR>HAVING COUNT(d.project_id) &#062; 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts