mysql - Sql query to combine 2 diff. column output based on conditions -


I want to add 2 columns to the new column based on the circumstances. Please check the query below. What I tried was

  Select 'Contacts'. ContactSarpsi``, 'Contacts'. 'Pars', 'Contacts'. Contact 'BDRPlus' with 'Contact'. WHERE (`` ContactPers``` parse ID` = 55) or (`ContactPers`.contactID = 55)) and` ContactPers`.`etat` = 1  

Output:

  contact_persID persID contactID 18 90 55 19 55 56 20 55 61 23 55 67  

The desired output is something (55 not in the new column, as it does Based on the circumstance, you want to add the press and contact ID.)

  contact_persID persID contactID newColumn 18 90 55 90 19 55 56 56 20 55 61 61 23 55 67 67  < / Pre> 

- Thank you

I'm not sure about MySQL. Here's how I should do it in SQL:

  Select 'Contacts' ContactSarpsi``, 'Contacts'. 'Paper', 'Contacts' 'Contact', 'Agent' Preceded 'When 55' 'Contacts' Contact 'ALSE' contacts. ' 'Bidrplus' with new column as 'FID'. Contact 'A' contact providers where in 55 (`contacts'. 'Paper', 'contacts' .contactID) and' contacts' .````` =  

Comments

Popular posts from this blog

sql - Find last match with latest inserted name in table -

c# - XML serialize base class without knowing derived class -

Send innerHTML text in URL in JSP -