[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

MySQL Two Relations from a table to another

Asked by zimba-tm in MySQL Server

Tags: mysql, tables, ticket_user, two

I have two tables.

The first is for emitting a ticket and contains informations about the problem.
The second-one is for listing the employées.

In the first table I need two fields referring to the employées.
One for who made the ticket
A second-one for who had worked ont the ticket.

CREATE TABLE ticket_rep (
  IdxTRep int(11) NOT NULL auto_increment,
  IdxTUser int(11) NOT NULL default '1',
  IdxTContact tinyint(4) NOT NULL default '1',                       <--- Here is the first contact
  IdxTContact2 tinyint(4) NOT NULL default '1',                     <--- Here is the second contact
  TRepTracking varchar(8) NOT NULL default '00000000',
  TRepDateStart datetime NOT NULL default '0000-00-00 00:00:00',
  TRepDateChange datetime NOT NULL default '0000-00-00 00:00:00',
  TRepDateEnd datetime NOT NULL default '0000-00-00 00:00:00',
  TRepFact varchar(64) NOT NULL default '',
  TRepAchat varchar(32) NOT NULL default '',
  TRepInventaire1 text NOT NULL,
  TRepInventaire2 text NOT NULL,
  TRepInventaire3 text NOT NULL,
  TRepProbleme1 text NOT NULL,
  TRepProbleme2 text NOT NULL,
  TRepProbleme3 text NOT NULL,
  TRepProbleme4 text NOT NULL,
  TRepProbleme5 text NOT NULL,
  TRepProbleme6 text NOT NULL,
  TRepProbleme7 text NOT NULL,
  TRepProbleme8 text NOT NULL,
  TRepProbleme9 text NOT NULL,
  TRepProbleme10 text NOT NULL,
  TRepGarantie1 tinyint(1) NOT NULL default '0',
  TRepGarantie2 tinyint(1) NOT NULL default '0',
  TRepGarantie3 tinyint(1) NOT NULL default '0',
  TRepGarantie4 tinyint(1) NOT NULL default '0',
  TRepGarantie5 tinyint(1) NOT NULL default '0',
  TRepGarantie6 tinyint(1) NOT NULL default '0',
  TRepGarantie7 tinyint(1) NOT NULL default '0',
  TRepGarantie8 tinyint(1) NOT NULL default '0',
  TRepGarantie9 tinyint(1) NOT NULL default '0',
  TRepGarantie10 tinyint(1) NOT NULL default '0',
  TRepReparation1 text NOT NULL,
  TRepReparation2 text NOT NULL,
  TRepReparation3 text NOT NULL,
  TRepReparation4 text NOT NULL,
  TRepReparation5 text NOT NULL,
  TRepReparation6 text NOT NULL,
  TRepReparation7 text NOT NULL,
  TRepReparation8 text NOT NULL,
  TRepReparation9 text NOT NULL,
  TRepReparation10 text NOT NULL,
  TRepCout1 double(6,2) NOT NULL default '0.00',
  TRepCout2 double(6,2) NOT NULL default '0.00',
  TRepCout3 double(6,2) NOT NULL default '0.00',
  TRepCout4 double(6,2) NOT NULL default '0.00',
  TRepCout5 double(6,2) NOT NULL default '0.00',
  TRepCout6 double(6,2) NOT NULL default '0.00',
  TRepCout7 double(6,2) NOT NULL default '0.00',
  TRepCout8 double(6,2) NOT NULL default '0.00',
  TRepCout9 double(6,2) NOT NULL default '0.00',
  TRepCout10 double(6,2) NOT NULL default '0.00',
  IdxTStatus tinyint(4) NOT NULL default '1',
  TRepCoutTotal double(8,2) NOT NULL default '0.00',
  TRepEnabled enum('T','F') NOT NULL default 'T',
  PRIMARY KEY  (IdxTRep),
  UNIQUE KEY TRepTracking (TRepTracking)
) TYPE=MyISAM;

CREATE TABLE ticket_contact (
  IdxTContact int(11) NOT NULL auto_increment,                      <--- They should be reffering to this
  TContactName varchar(255) NOT NULL default '',
  TContactMail varchar(255) NOT NULL default '',
  TContactTel varchar(255) NOT NULL default '',
  PRIMARY KEY  (IdxTContact)
) TYPE=MyISAM;


Now the question is :   What is the join query that gives me the two names ?

This is my actual query :
SELECT `ticket_rep`.`IdxTRep`,
      `ticket_rep`.`TRepTracking`,
      `ticket_rep`.`TRepDateStart`,
      `ticket_rep`.`TRepDateChange`,
      `ticket_rep`.`TRepDateEnd`,
      `ticket_rep`.`TRepFact`,
      `ticket_rep`.`TRepAchat`,
      `ticket_rep`.`TRepInventaire1`,
      `ticket_rep`.`TRepInventaire2`,
      `ticket_rep`.`TRepInventaire3`,
      `ticket_rep`.`TRepProbleme1`,
      `ticket_rep`.`TRepProbleme2`,
      `ticket_rep`.`TRepProbleme3`,
      `ticket_rep`.`TRepProbleme4`,
      `ticket_rep`.`TRepProbleme5`,
      `ticket_rep`.`TRepProbleme6`,
      `ticket_rep`.`TRepProbleme7`,
      `ticket_rep`.`TRepProbleme8`,
      `ticket_rep`.`TRepProbleme9`,
      `ticket_rep`.`TRepProbleme10`,
      `ticket_rep`.`TRepGarantie1`,
      `ticket_rep`.`TRepGarantie2`,
      `ticket_rep`.`TRepGarantie3`,
      `ticket_rep`.`TRepGarantie4`,
      `ticket_rep`.`TRepGarantie5`,
      `ticket_rep`.`TRepGarantie6`,
      `ticket_rep`.`TRepGarantie7`,
      `ticket_rep`.`TRepGarantie8`,
      `ticket_rep`.`TRepGarantie9`,
      `ticket_rep`.`TRepGarantie10`,
      `ticket_rep`.`TRepReparation1`,
      `ticket_rep`.`TRepReparation2`,
      `ticket_rep`.`TRepReparation3`,
      `ticket_rep`.`TRepReparation4`,
      `ticket_rep`.`TRepReparation5`,
      `ticket_rep`.`TRepReparation6`,
      `ticket_rep`.`TRepReparation7`,
      `ticket_rep`.`TRepReparation8`,
      `ticket_rep`.`TRepReparation9`,
      `ticket_rep`.`TRepReparation10`,
      `ticket_rep`.`TRepCout1`,
      `ticket_rep`.`TRepCout2`,
      `ticket_rep`.`TRepCout3`,
      `ticket_rep`.`TRepCout4`,
      `ticket_rep`.`TRepCout5`,
      `ticket_rep`.`TRepCout6`,
      `ticket_rep`.`TRepCout7`,
      `ticket_rep`.`TRepCout8`,
      `ticket_rep`.`TRepCout9`,
      `ticket_rep`.`TRepCout10`,
      `ticket_rep`.`TRepCoutTotal`,
      `ticket_rep`.`IdxTStatus`,
      `ticket_user`.`TUserName`,
      `ticket_user`.`TUserSurname`,
      `ticket_user`.`TUserCompany`,
      `ticket_user`.`TUserTel1`,
      `ticket_user`.`TUserTel2`,
      `ticket_user`.`TUserMobile`,
      `ticket_user`.`TUserPrivate`,
      `ticket_contact`.`TContactName`,
      `ticket_contact`.`TContactMail`,
      `ticket_status`.`TStatusName`
    FROM `ticket_status`
    INNER JOIN `ticket_rep` ON (`ticket_status`.`IdxTStatus` = `ticket_rep`.`IdxTStatus`)
    INNER JOIN `ticket_user` ON (`ticket_rep`.`IdxTUser` = `ticket_user`.`IdxTUser`)
    INNER JOIN `ticket_contact` ON (`ticket_rep`.`IdxTContact` = `ticket_contact`.`IdxTContact`)
    WHERE `ticket_rep`.`TRepTracking`='$MyTrackingNumber'

Help  !!! :-P
[+][-]05/22/03 07:08 AM, ID: 8564716Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/22/03 07:18 AM, ID: 8564799Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/22/03 07:20 AM, ID: 8564822Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/22/03 07:29 AM, ID: 8564907Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: MySQL Server
Tags: mysql, tables, ticket_user, two
Sign Up Now!
Solution Provided By: VGR
Participating Experts: 1
Solution Grade: A
 
[+][-]05/22/03 07:45 AM, ID: 8564998Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/22/03 07:55 AM, ID: 8565064Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89