| Author |
Can i search for item by giving three items to compare in the query?
|
Yuta Lolap
Ranch Hand
Joined: Jun 03, 2012
Posts: 65
|
|
Hello all,
I am trying to search for the cust id based on these three constraints. Will it work? Is it ok to use three columns to compare data?
"select cust id from customers where fname = ? and lname = ? and flatno = ?";
|
 |
Bill Gorder
Bartender
Joined: Mar 07, 2010
Posts: 1282
|
|
|
This looks like an ordinary parametrized query. I don't see anything ORM related here, so I am moving it to the JDBC forums. You can add as many restrictions as you would like in your where clause. However having a space in cust id looks suspect.
|
[How To Ask Questions][Read before you PM me]
|
 |
Wendy Gibbons
Bartender
Joined: Oct 21, 2008
Posts: 1098
|
|
the column cust id will need around it if it really does have a space in the column name.
what you entered is valid sql and whether it is good enough depends on your data, for example many families name the first son after the father so will have 2 arthur smiths living in flat 4b.
|
 |
 |
|
|
subject: Can i search for item by giving three items to compare in the query?
|
|
|