On 2015-03-22 04:15 PM, Bart Smissaert wrote: > Sorry, that table did indeed not have a column named emis_number, my > mistake. > Still, the error message ambiguous column name doesn't seem quite right. > Should that not also be no such column: emis_number?
But this is not true, there /IS/ a column called emis_number, just not in the table you /WANT/ it to be looking at, but since you were not clear about which table it should be looking at there is a very serviceable column named emis_number in a table referenced elsewhere in the query... which on another day you might actually need to refer too in the sub-query, so that should not fail. This means that is not an error - but you are not asking the SQL engine very clear questions, it is confused (much as the rest of us) about what you really want to see - it can't be deduced from the query. Remember that in your mind the words "emis_number" and "usual_gp_index" makes sense and is automatically associated with certain tables or patient stats, but to everyone else (including the QP) we need very specific references to follow the logic of what you intend to see. I've made this mistake many times, good luck! Ryan