Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8992767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:02:06+00:00 2026-06-15T23:02:06+00:00

I’ve got table TContractForm with fields idcontract(primary key),idcntrtype(foreign key),date_begin,date_end,cost . Also I’ve got 3

  • 0

I’ve got table TContractForm with fields idcontract(primary key),idcntrtype(foreign key),date_begin,date_end,cost. Also I’ve got 3 types of contracts:

TRentWhouseContract with fields idcontract,idclient,idpdtwhs

TRentShoppointContract with fields idcontract,idclient,idshoppoint,idshoptype

TRentEquipContract with fields idcontract,idclient,ideq,amount

idcntrtype – type of contract. TContractType – idcntrtype(primary key),idcntrclass(foreign key),name. TContractClass – idcntrclass,name.

I want to create a view with columns
idcontract,idclient,contract_type(name of type),contract_class(name of class),date_begin,date_end,cost.

But my query return nothing(I know I’ve got several contracts in TRentWhouseContract table(other tables has no rows)(it is without idclient because I don’t know how to get the same idclient from different table if some table are empty).

select TCF.idcontract,
   --idclient
   TCF.date_begin,
   TCF.date_end,
   TCT.name as [type],
   TCC.name as class,
   TCF.cost
from TContractForm as TCF,
 TRentEquipContract as TREC,
 TRentShopPointContract as TRSPC,
 TRentWhouseContract as TRWC,
 TContractType as TCT,
 TContractClass as TCC
where TCF.idcontract = TREC.idcontract or TCF.idcontract = TRSPC.idcontract
  or TCF.idcontract = TRWC.idcontract and TCT.idcntrtype = TCF.idcntrtype
  and TCT.idcntrclass = TCC.idcntrclass
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:02:07+00:00Added an answer on June 15, 2026 at 11:02 pm

    If I understand correctly, this is what I would do

    select TCF.idcontract,
       --idclient
       TCF.date_begin,
       TCF.date_end,
       TCT.name as [type],
       TCC.name as class,
       TCF.cost
    from TContractForm as TCF
    JOIN TContractType as TCT
       ON TCT.idcntrtype=TCF.idcntrtype
    JOIN TContractClass as TCC
       ON TCT.idcntrclass = TCC.idcntrclass
    UNION
    select TCF.idcontract,
       --idclient
       TCF.date_begin,
       TCF.date_end,
       TCT.name as [type],
       TCC.name as class,
       TCF.cost
    from TRentWhouseContract as TCF
    JOIN TContractType as TCT
       ON TCT.idcntrtype=TCF.idcntrtype
    JOIN TContractClass as TCC
       ON TCT.idcntrclass = TCC.idcntrclass
    UNION
    select TCF.idcontract,
       --idclient
       TCF.date_begin,
       TCF.date_end,
       TCT.name as [type],
       TCC.name as class,
       TCF.cost
    from TRentShoppointContract as TCF
    JOIN TContractType as TCT
       ON TCT.idcntrtype=TCF.idcntrtype
    JOIN TContractClass as TCC
       ON TCT.idcntrclass = TCC.idcntrclass
    UNION
    select TCF.idcontract,
       --idclient
       TCF.date_begin,
       TCF.date_end,
       TCT.name as [type],
       TCC.name as class,
       TCF.cost
    from TRentEquipContract as TCF
    JOIN TContractType as TCT
       ON TCT.idcntrtype=TCF.idcntrtype
    JOIN TContractClass as TCC
       ON TCT.idcntrclass = TCC.idcntrclass
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.