Variable column names using prepared statements

后端 未结 7 619

I was wondering if there was anyway to specify returned column names using prepared statements.

I am using MySQL and Java.

When I try it:

St         


        
7条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 08:42

    Below is the solution in java.

    String strSelectString = String.format("select %s, %s from %s", strFieldName, strFieldName2, strTableName);
    

提交回复
热议问题