Join query issue - syntax error near join
<pre><code>   TRADERS                                            INCENTIVE
   __________________________________________      _____________
   TRDID  NAME  SUPERVISOR  LOCATION   PAY         TRDID  INCENTIVE
   ------------------------------------------      -------------
  66  Chad                 NY         110000        17    5000
  17  Yena          66     TN          75000        21    2000
   5  Karam         66     TN          80000         66    5000
  21  Rose           5     HI         100000      ...


 --group by highest pay for location and traderid                                               

                   select e.trdid trdid, e.location, max (e.pay+ coalesce(b.incentive, 0))  maxtotal  from traders e
                        join incentive b on e.trdid = b.trdid
                            group by e.location, trdid
                   join (                       
                   (select e.trdid trdid, max (e.pay+ coalesce(b.incentive, 0))  maxtotal  from traders e
                join incentive b on e.trdid = b.trdid
               group by e.location, e.trdid)) using (trdid)
</code></pre>

<p>I get an error when I try to join the table and its subquery.
I am trying this in PostgreSQL</p>

<p>I am trying to get only the  highest paid trader in each location based on ranking of pay and incentive put together as totalpay.  I want to print
   trader name, pay, incentive, and total pay (pay plus incentive).</p>

<p>Please can you advice what is wrong with my query? I get an error stating syntax error near join</p>