I have 2 tables... t_table and p_table I want the Min Max values in p_table to relate to the records in t_table SELECT * FROM t_table ----------- SELECT p_id, MIN(total),MAX(total) FROM p_table GROUP BY p_id How could i merge these queries together....or is there another way?
This sis sudo code, because I don't know what on the t_table you are wanting to relate. Code: SELECT * FROM t_table SELECT t_table.*,p_table.p_id, p_table.MIN(total),p_table.MAX(total) FROM p_table,t_table GROUP BY p_id
jwshepherd , im trying to relate p_table.p_id to t_table.p_id so p_table.total will match up against the records in t_table
Code: SELECT t_table.t_id, t_table.p_id, Min(p_table.total) AS MinOftotal, Max(p_table.total) AS MaxOftotal FROM p_table INNER JOIN t_table ON p_table.p_id = t_table.p_id GROUP BY t_table.t_id, t_table.p_id WITH OWNERACCESS OPTION;