Tuesday 15 April 2014

mysql - Complex search SQL Query -


I need your help with a SQL query

I need the value selected in the table Where the math element is the most orderly order, I currently have the following questions:

  SELECT p.confirmation, p.lname, P.fname, p. Profile, A.Edress 1, AACT, c. Leave contact contact p from p.confirmation = c.profileid and c ORD = 1 left on a contact p. Configuration = A .profileid and a.ord = 1   

This work is fine when the smalest "a.ord" or c.ord "1. But the smallest value will not always be one, This could be another digit, so I did not give any success to the following:

  SELECT p.confirmation, p.lname, p.fname, p.profiletype, a.address1, a ON.P.confirmation = c.profileid min (c.ord) LEFT JOIN one ON p.confirmation = a.profileid min (a.ord) address  on contact contact except ccontactinfo profile page.  

I have replaced "AND a.ord = 1" by "end (a.ord)".

I can do this for two different queries.

Is there a way that I can add something in the type of

 Contact