ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

SQL help



Tim.

ClioSport Club Member
I have a query that returns 100 fields from 20 tables.

One of the lines in the select statement is:

CASE WHEN Column1 IS NULL THEN PLSupplierAccount.Salesperson ELSE Column1 END AS Sales_Agent,

I’ve not anonymised it, that’s what it actually says.

Why does it say Column1 - as far as I can see there is no field in any of the 20 table that’s called Column1.
 

Oggy997

ClioSport Club Member
  997.1, Caddy, e208
I've never even considered that an option in SQL, but i can see the logic in how it would work.

What do you need help with, though? It's s surely just applying the case statement to the first returned column in the select.
 

charltjr

ClioSport Club Member
Is it part of a stored procedure? It would be horrendous from a readability perspective, but if they're defining @Column1 somewhere then that could do it.

When you say SQL, do you mean MSSQL or one of the other types?
 

Tim.

ClioSport Club Member
Is it part of a stored procedure? It would be horrendous from a readability perspective, but if they're defining @Column1 somewhere then that could do it.

When you say SQL, do you mean MSSQL or one of the other types?
I’m afraid I don’t know the answer… to either of your questions! 🤷‍♂️
 

charltjr

ClioSport Club Member
Ah, OK, fair enough. What tool are you using to run the SQL? Is it MS Access/SQL Developer/Something else?

At the moment all I can really suggest is doing a text search through the SQL and looking for anywhere that Column1 is being set, probably look something like "@Column1 = <something>"
 


Top