I'm trying to determine what you want displayed from your SELECT.  I see 3
different displays  that you want:
a.   SUBID,t1.ID,t1.FILE,t1.DATE,t1.DISCIPLINE,t2.NAME,t2.SUBID
b.   t3.DISCIPLINE,t3.NAME,t3.EMAIL
c.   table2.NAME,table3.NAME, table3.EMAIL

Which do you want?

-----Original Message-----
From: Pawandeep Lamba [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 9:56 AM
To: [EMAIL PROTECTED]
Subject: QUERY HELP - IF THEN ELSE


Hi...
I want to output results based on the query from 3 tables ( described here )

TABLE 1
        SUBID (SAME AS IN TABLE 2)
        ID
        FILE
        DATE
        DISCIPLINE (SAME AS IN TABLE 3)

TABLE 2
        NAME
        SUBID (SAME AS IN TABLE 1)

TABLE 3
        NAME
        EMAIL
        DISCIPLINE (SAME AS IN TABLE 1)

HERE IS MY QUERY, USED IF THEN ELSE to show what i am trying to do. What's 
the best/right way to accomplish the results.

----------------------------------------------------------------
select t1.SUBID,t1.ID,t1.FILE,t1.DATE,t1.DISCIPLINE,
t2.NAME,t2.SUBID
from PROPOSALS AS t1, PROFILE AS t2
where t1.ID=0 and t1.SUBID=t2.SUBID
                        IF(t1.DISCIPLINE='Other') THEN(select
t3.DISCIPLINE,t3.NAME,t3.EMAIL 
from ASSOCIATES AS t3)
                        ELSE(select t3.DISCIPLINE,t3.NAME,t3.EMAIL from
ASSOCIATES AS t3 where 
t1.DISCIPLINE=t3.DISCIPLINE)
order by t1.DATE
-----------------------------------------------------------------

My output is going to show
FILE FROM TABLE 1
NAME FROM TABLE 2
NAME FROM TABLE 3
EMAIL FROM TABLE 3

-tia


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to