Need help writing a MySQL query for the following in a dreamweaver recordset Im trying to Display the MIN MAX values from each ID in T_table so for example I have 4 records with the ID of 1 and 4 records with the ID of 2 etc P_table P_ID P_name P_image -------------- T_table T_ID T_number Then i would like to match T_table.ID to P_table.ID So the Min Max values of T_number will be related to the information on P_table Hope this makes sense
It kinda makes sense. I think you need some syntax like: SELECT MAX(sale_amt) AS MaxAmount, MIN(sale_amt) AS MinAmount If you want related data from another table you will need a JOIN statement so Google "MySQL Join" to see how that works.
when i run the test in the recordset it shows the information of both tables linked together, with this query. SELECT * FROM T_table,P_table WHERE T_table.prod_id=P_table.prod_id; but when i run the repeat region which contains info from both tables it just shows the highest number of all the records for each record. (from P_table) If anyone can point me in the right direction the following statement, would probably need to be in the mix some where MIN(number),MAX(number)
Here's something that is close. It works in SQL Server and should work in MySQL. I leave the join to you. SELECT DISTINCT T_id, MAX(T_number) AS Expr1 FROM dbo.test GROUP BY T_id