President Trump has offered his "deepest sympathies" to those affected by the shooting at a synagogue in San Diego.