The primary or first holder of the joint demat account will be liable to pay taxes on the P&L. Though you can have a joint demat account, your trading account will always have a single holder. Hence the single trading account holder who will be the primary account holder for the joint demat account will be responsible for the tax payment.