[thelist] help with tricky select statement

rudy r937 at interlog.com
Sat Jul 20 04:14:00 CDT 2002


> select user_id,emp_num
> from tbl_user_data t1
 > where entry_num='1'
>  and emp_num=(select emp_num from tbl_user_data t2
>    where entry_num='2' and t2.emp_num=t1.emp_num)

michael, this looks a self-join (and there's another way to write it)

> is there a way i can say get weight from first and get weight from
> second record from tbl_user_data where emp_num is the same?

before i give it a try, could you explain what you mean by weight?

if that's a separate column, it should be easy

are you interested in only those users that have both types of entry_num?
what if they have only 1 or 2 but not both?  and do you need the weight
separately for both, or would you like the weights combined?

rudy




More information about the thelist mailing list