Parameter in SELECT clause for @Query?

Anton Petrovskyi

While using a verbatim entered column name works fine in an SQL/JPA query, is it possible to use a variable?

@Query(value = "select distinct ?1 from Product", nativeQuery = true)
List<String> findOneColumn(String columnName);

This code appears to fail. It seems that it's not allowed to use parameters in SELECT clause (but works with WHERE clause). Is there any alternatives?

How can I set the column name dynamically?

Anton Petrovskyi

Seems that Parameter in SELECT clause for @Query is not allowed pleasure :)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to use a dynamic parameter in a IN clause of a JPA named query?

From Dev

SELECT query returns no result without ORDER BY clause

From Dev

MySQL select query with parameter

From Dev

SELECT query using multiple AND in where clause

From Dev

select query in hibernate with where clause

From Dev

How to add parameter to clause in PDO query

From Dev

Using Distinct with Top in Select Clause of Query

From Dev

SQL query with an OR clause and only one parameter

From Dev

How to use column in result set as parameter to FROM clause in a SELECT

From Dev

Select Query with IN clause - having duplicate values in IN clause

From Dev

mysql query to select user count with Like clause

From Dev

Error:A query body must end with a select clause or a group clause

From Dev

MySQL select query in where clause

From Dev

Is there any way to select records if top clause parameter is null?

From Dev

How to rewrite a sub query in a select clause as a CTE

From Dev

SQL select query with not not in clause

From Dev

Query regarding LIKE clause and Select Statement in SQLworkbench

From Dev

Select In query how to order in where clause racle

From Dev

How to add parameter to clause in PDO query

From Dev

cassandra query on map in select clause

From Dev

Using Distinct with Top in Select Clause of Query

From Dev

Insert with Select clause Nodejs query string

From Dev

SQL insert query inside select or where clause

From Dev

Optimize MYSQL query TIMEDIFF in Select and where Clause

From Dev

Use returned value from query in the a where clause for another select query

From Dev

Use result of 'IF' in 'SELECT' in 'WHERE' clause in SQL query

From Dev

Mysql: Select Count And IN Clause in One Query

From Dev

Query SQL with variable parameter in where clause

From Dev

display column in select query not added in group by clause

Related Related

  1. 1

    How to use a dynamic parameter in a IN clause of a JPA named query?

  2. 2

    SELECT query returns no result without ORDER BY clause

  3. 3

    MySQL select query with parameter

  4. 4

    SELECT query using multiple AND in where clause

  5. 5

    select query in hibernate with where clause

  6. 6

    How to add parameter to clause in PDO query

  7. 7

    Using Distinct with Top in Select Clause of Query

  8. 8

    SQL query with an OR clause and only one parameter

  9. 9

    How to use column in result set as parameter to FROM clause in a SELECT

  10. 10

    Select Query with IN clause - having duplicate values in IN clause

  11. 11

    mysql query to select user count with Like clause

  12. 12

    Error:A query body must end with a select clause or a group clause

  13. 13

    MySQL select query in where clause

  14. 14

    Is there any way to select records if top clause parameter is null?

  15. 15

    How to rewrite a sub query in a select clause as a CTE

  16. 16

    SQL select query with not not in clause

  17. 17

    Query regarding LIKE clause and Select Statement in SQLworkbench

  18. 18

    Select In query how to order in where clause racle

  19. 19

    How to add parameter to clause in PDO query

  20. 20

    cassandra query on map in select clause

  21. 21

    Using Distinct with Top in Select Clause of Query

  22. 22

    Insert with Select clause Nodejs query string

  23. 23

    SQL insert query inside select or where clause

  24. 24

    Optimize MYSQL query TIMEDIFF in Select and where Clause

  25. 25

    Use returned value from query in the a where clause for another select query

  26. 26

    Use result of 'IF' in 'SELECT' in 'WHERE' clause in SQL query

  27. 27

    Mysql: Select Count And IN Clause in One Query

  28. 28

    Query SQL with variable parameter in where clause

  29. 29

    display column in select query not added in group by clause

HotTag

Archive