java - SQL get first instance of specific data from a row -


so have sql table looks enter image description here

i'm trying insert player name first instance of empty p1name, p2name etc, , insert tablenumber tablenumber=mintable i'm new sql wrong, i'm confused on how this. tried..

sql = "select * slot tables "                                 + "where p1name = 'empty'"                                  + " or p2name = 'empty'"                                 + " or p3name = 'empty'"                                 + " or p4name = 'empty'"                                 + " or p5name = 'empty'"                                 + " or p6name = 'empty'"                                 + "and tablenumber = '" + mintable + "'"; 

it's giving me sql exception error no detail i'm not sure i'm doing wrong here, if has insight whatsoever appreciated.

try this:

sql = "select * tables where"                             + "( p1name = 'empty'"                              + " or p2name = 'empty'"                             + " or p3name = 'empty'"                             + " or p4name = 'empty'"                             + " or p5name = 'empty'"                             + " or p6name = 'empty' )"                             + " , tablenumber = '" + mintable + "'"; 

something this. ' * ' character means "all". explication is:

select all data tables (col1='x' or col2='y' or ..) , coln = 'x'


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -