Good morning !
I have a question about the reported speech please .
The direct speech : " Where have you worked before ? " The boss asked David .
Now , in the reported speech we say : " The boss asked David where he had worked before "
Or : " The boss asked David where had he worked before "
The first version is correct.