Several SELECT SQL Query
Application Type


I want to do several SELECT in one SQL query. I want to recover the DISTINCT values of my columns (all columns will not have the same quantity of value) and store them in my Structure of Text List Equipement.

I created text list in this structure which are named "name" and "price"

Here my query that works perfectly for one column but i can't do it for several column in one time.

SELECT DISTINCT {Equipement}.name

FROM {Equipement}




Hi Julien,

I am not sure what do you want to achieve.

Can you provide more details? Such as your entity structure and what result you want to get.

Kind Regards,

Hello Tom,

I want to write a SQL Query that return the distinct of my name column and the distinct of price column. 

I don't care about the order of values because each column will be used for an independent dropdown

Example :

Name    Price

A            10

B            21

A           45

C           45

D          20

B          20

I want the result :

Name          Price

A                  45

B                  20

C                  10


Hi Julien,

which value do you want in the Price column? Max? Min? Avg? Sum?


I want all the distinct value of the attribute "price" of my Equipement table

So you only need the attribute price.

If you choose Name also you will have 2 values for price 45 (A and C)

I don't want to have the same number of rows in name and price. (unless if the number of the distinct values of "name" is the same that the distinct of "price"

You can't do that in SQL. All columns have the same number of rows.

You do the following, create a table in an screen and assign the result of a distinct prices sql query.

Then add a new column and insert a block there with an input parameter of the price of the other column.

Then in the block created insert a list with the products with the price in the input parameter.

Hello @Julien Garcia 

If each (Name, Price) will be a different drop down, why not get these separately i.e. in separate SQL queries?



Hi AJ,

yes it works. But i have nearly 80 dropdown so if i can compact the queries is better.

Because we have to create One structure per SQL query...

What i want is to create a structure which contains text list and so not have to create 80 structure but 8 Strutures each containing 10 text list 

Hi Julien,

Can you tell more of what your use case is ?  Because a lot of what you are saying sounds a bit strange and/or not really good design.

80 dropdowns on a screen ??

If you are only looking for a given columns distinct values, you don´t need an sql widget, so no need for structure

All you say also sounds like you don´t really understand sql.  Result of a query are rows of related column values, so the idea of different number of results for each column is quite outlandish.   

That being said, there is following ugly solution that might roughly do what you need : UNION all distinct selects, each filling a different column of your output structure .  Then put results of each column in another local list that will serve as source of your dropdowns, and filter out the empties. 


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.