Print Page | Close Window

query help

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=1410
Printed Date: 28 March 2026 at 3:11pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: query help
Posted By: xdotnet
Subject: query help
Date Posted: 27 March 2003 at 11:46am
Hi,

I need some help with this query,
i'm try to get the max(table3_dateEntered) and is table3_name from TABLE3
from select distinct table1_id, table1_name from TABLE1:


TABLE1
table1_id [pk]
table1_name

TABLE2
table2_id [pk]
table1_id [fk]

TABLE3
table3_id [pk]
table3_dateEntered
table3_name
table2_id [fk]



SELECT
t1.table1_id, t1.table1_name, t3.table3_name, max(t3.table3_dateEntered)
FROM
(select distinct table1_id from TABLE1), TABLE3 t3, TABLE2 t2, TABLE1 t1
WHERE
t2.table1_id = t1.table1_id
AND
t3.table2_id= t2.table2_id
GROUP BY
t1.table1_id, t1.table1_name, t3.table3_name


My query display my data but not for distinct table1_id. The problem come from
t3.table3_name, if i remove it from my query, i get my distinct table1_id

Any idea how can this be work ?

thanks.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net