Skip to content
Advertisement

Julia: How to get dataframe value into single variable

I am modifying Julia code that I did not write myself. I have worked very little in Julia. I’ve concatenated a string to create a SQL Query that returns a single integer value from the database. I want to use the returned value in the next sql string. However, the value returned from the initial SQL Select statement is a 1×1 dataframe. My assumption is I need to assign returned value to a integer variable that can be used in the subsequent SQL String.

Based on the returned empid I want to run additional SQL Query that will return a dataframe from the database.

However, this results in the above SQL error as relempid is itself a 1×1 dataframe.

I’m sure this is probably simple enough, but I can’t manage to get it working.

Advertisement

Answer

I understand you have a DataFrame like this:

In that case simply note that DataFramess can be indexed just like matrices:

Of course you could also reference the value by column name:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement