urgent pls help thx

Results 1 to 2 of 2

Thread: urgent pls help thx

  1. #1
    Join Date
    Dec 1969

    Default urgent pls help thx

    i have three table<BR>example table1 &#039;list all the avaliable countries<BR>ID txtTable1<BR>1 USA<BR>2 AUS<BR>3 ENG<BR>4 JPN<BR>5 EUR<BR>table2<BR>ID txtTable2<BR>1 USA<BR>2 USA<BR>3 ENG<BR>4 JPN<BR>5 EUR<BR>6 JPN<BR>7 USA<BR>8 JPN<BR><BR>table3<BR>ID txtTable3<BR>1 USA<BR>2 USA<BR>3 USA<BR>4 JPN<BR>5 AUS<BR>6 JPN<BR>7 USA<BR>8 JPN<BR><BR>my outcome is to show table one in the first field,<BR>second field is to count from table one, show how many countries relevant to table 1, same as third field <BR>Countries Table2 Table3<BR>USA 3 4<BR>AUS 0 1<BR>ENG 1 0<BR>JPN 3 3<BR>EUR 1 0<BR><BR>i use outer join but always will always show the bigger one eg.<BR>Countries Table2 Table3<BR>USA 4 4<BR>AUS 0 1<BR>ENG 1 0<BR>JPN 3 3<BR>EUR 1 0<BR><BR>pls help thx

  2. #2
    Join Date
    Dec 1969

    Default RE: urgent pls help thx

    select country,<BR>(select count(*) from table2 where country = t.country) as tx2,<BR>(select count(*) from table3 where country = t.country) as tx3<BR> from table1 as t

Posting Permissions

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