Joing 2 tables dutch pls help

Results 1 to 2 of 2

Thread: Joing 2 tables dutch pls help

  1. #1
    Join Date
    Dec 1969

    Default Joing 2 tables dutch pls help

    select count(*) from MESSAGE_ASTO MA,MESSAGE_MASTER MM WHERE MM.MESSAGE_ID=MA.MESSAGE_ID AND; OR MM.INITIATOR=&#039;; AND MM.MESSAGE_ID=2 <BR><BR>Message_master(message_id,message)<BR>Mess age_ASTO(message_id,AS_TO)<BR><BR>What I need is count of the records if ma.as_to=&#039;; or mm.initiator=&#039;; but its thowing count of all the records<BR><BR>pls help

  2. #2
    Join Date
    Dec 1969

    Default RE: Joing 2 tables dutch pls help

    You just need brackets in the where clause to control the order of the filtering...<BR><BR>select count(*)<BR>from MESSAGE_ASTO MA, MESSAGE_MASTER MM<BR>where MM.MESSAGE_ID=MA.MESSAGE_ID AND (MA.AS_TO=&#039;; OR MM.INITIATOR=&#039;;) AND MM.MESSAGE_ID=2 <BR><BR>Personally I&#039;d also change the join...<BR><BR>select count(*)<BR>from MESSAGE_ASTO MA<BR>join MESSAGE_MASTER MM on MM.MESSAGE_ID=MA.MESSAGE_ID<BR>where (MA.AS_TO=&#039;; OR MM.INITIATOR=&#039;;) AND MM.MESSAGE_ID=2 <BR><BR>Gavin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts