Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selection query : problem with 'ORDER BY'

Status
Not open for further replies.

leifoet

Technical User
Jan 31, 2016
206
BE
fp_sQry="
SELECT tableB.*,
(Select Sum(AntlAh) FROM tableB) AS [TTAntlAh],
tableA.Fname, tableA.Lname, tableA.mailadress, tableA.GSM

FROM tableB
LEFT JOIN tableA ON tableB.LnameAh=tableA.Lname

ORDER by Ah-Id ASC"

=> gives this error :
Database Results Error - Description: No value given for one or more required parameters.

=> without <ORDER BY Ah-Id ASC> or <ORDER BY ... DESC> it works fine.

Possible causes : wrong combination JOIN vs ORDER BY ? elements not in the correct order in the query ?

Thanks for tips - Leifoet

 
The hyphen in Ah-Id may be causing the error. Try surrounding it in brackets:

[tt]ORDER BY [Ah-Id][/tt]
 
Hi Leifoet,

What table is "Ah-Id" from? The query won't know.
==>
ORDER BY tableA.[Ah-Id]

best regards,
MakeItSo

"Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family." (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Dear MakeItSo, that is the solution, indeed it works.
Thanks for help. - Leifoet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top