Skip to main content
Question

Select Statement Assistance

  • July 27, 2026
  • 1 reply
  • 8 views

We want to have a list of states and our license numbers to work in those states. There is a built in table for states that I thought to use for this purpose. Before even adding license numbers to that table, I tried to supply a state code and get the state name from the table, however something is not working. I have used nested SELECT statements before elsewhere, but it seems to fail here.

The inside Select statement returns what I would expect. A state code from the address ID of the Customer. If I use a different state code that isn’t a select, but just a dummy variable, the outer Select statement returns the state name. But when I put it all together, it seems to fail.

Is anyone able to tell me what I am missing?

Using these arguments: v.Customer_No, v.Ship_Addr_No

SELECT State_Name FROM State_Codes_Tab WHERE State_Code = (SELECT State FROM Customer_Info_Address WHERE (Customer_Id = :Customer_No) AND (Address_Id = :Ship_Addr_No)) AND Country_Code = 'US'

 

1 reply

NickPorter
Superhero (Customer)
Forum|alt.badge.img+18
  • Superhero (Customer)
  • July 27, 2026

It would be helpful if you could explain what you mean by ‘it seems to fail’.  No results? Error message?  Unexpected result?

First thought is that you might have a difference in values since the state code may not be syntactically the same.  This might be fixable by applying ‘UPPER’ to the State value in the inner select and , for example.   

Examples of what you’re using to test and the result or error you are getting would help us if the above doesn’t help you.

HTH,

Nick