4 Replies - 228 Views - Last Post: 15 June 2013 - 12:54 PM Rate Topic: -----

#1 CP3  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 51
  • Joined: 21-October 12

How to go about writing this query

Posted 15 June 2013 - 11:46 AM

I've been trying this for a few hours but can't seem to get a hang of it.

Client
Client_No
Client_name
Client_active
Client_region

ClientContract
Contract_num
contract_year
contractt_issuernum
Client_No

My problem is that I'm trying to link an active client, from a certain region to the latest contract. I need to print client_name and contract_num
Is This A Good Question/Topic? 0
  • +

Replies To: How to go about writing this query

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9260
  • View blog
  • Posts: 34,748
  • Joined: 12-June 08

Re: How to go about writing this query

Posted 15 June 2013 - 12:15 PM

is there a table or something that highlights the relationship between client and contract number - or is that the first column? If it's the latter then that's a bad way of doing it. You should have a table for clients.. a table for contracts.. and then a table relating clients to contract numbers.
Was This Post Helpful? 0
  • +
  • -

#3 CP3  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 51
  • Joined: 21-October 12

Re: How to go about writing this query

Posted 15 June 2013 - 12:38 PM

Client_No is a PK for Client and a FK for ClientContract.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9260
  • View blog
  • Posts: 34,748
  • Joined: 12-June 08

Re: How to go about writing this query

Posted 15 June 2013 - 12:43 PM

.. can more than one client be attached to a contract?
Was This Post Helpful? 0
  • +
  • -

#5 CP3  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 51
  • Joined: 21-October 12

Re: How to go about writing this query

Posted 15 June 2013 - 12:54 PM

No. Sorry for not clarifying this earlier.

1 Client can have multiple contracts (multiple years)
1 contract can be assigned to 1 and only 1 client.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1