English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Can someone tell me how to use fix thls sql statement at the end?

sql = "SELECT reqOpen FROM supRequest WHERE reqOpen = 'Yes'

I want to select records from my DB where the field "reqOpen" has the value of "Yes".

Thanks!

2007-01-17 13:18:47 · 8 answers · asked by UBigDummie 1 in Computers & Internet Programming & Design

Yes, reqOpen is a column (or field) in supRequest.

2007-01-17 13:24:00 · update #1

8 answers

I am not sure why you are selecting reqOpen when you specified the criteria for reqOpen - this is just going to give you a dataset that is one column wide and has a bunch of "Yes" values.

If you are asking how to select the *entire* record for each record that has a reqOpen value of "Yes", you need to "SELECT * FROM..." to get all columns, or explicitly name the columns you want, delimited by commas.

2007-01-17 13:26:55 · answer #1 · answered by Rex M 6 · 2 0

What is the type of the reqOpen column? Is it char, varchar or boolean. If it is char, then the statement is ok, if it is boolean, "Yes" is 1 (or -1 in some databases, e.g. Access) and "No" is always 0.
In this case:
SELECT reqOpen From supRequest WHERE reqOpen <> 0

2007-01-17 19:08:47 · answer #2 · answered by BataV 3 · 0 0

What sq. database do you have? sq. is purely the question language. you want a database that knows the sq. language to be waiting to apply it, as an occasion, MySQL, Oracle Database, Microsoft sq. Server, and so on. sq. is the language that lets you talk on your database to function archives, exchange or delete archives, and so on. After installation and installation your sq. database, you may then use sq. to first create your database and then artwork with the suggestion. There are 3 wide-unfold suggestion on a thank you to go into sq. statements: a million. Command line. you may the two enter out of your computing device's command/terminal window, or a custom command window put in by using the database. it fairly is the main direct and least puzzling thank you to talk to the database, ie, entering sq. statements. 2. by way of some GUI interface. for people who discover the command line daunting, there are GUI purposes (with homestead windows, menus, buttons, and so on.) that permit you enter sq. instructions and do different applications with the database. as an occasion, the MySQL GUI kit has the MySQL question Browser. 3. Code sq. statements into your software. you do not positioned sq. statements spectacular on the HTML internet internet site, considering the fact it fairly is a large protection flaw. you do not % human beings to be waiting to get right of entry to your database and thieve or wreck your archives. so which you ought to get right of entry to your database, you place the sq. statements into your backend application server and whilst a internet site customer clicks on a hyperlink to develop archives out of your database, that hyperlink will call you software which connects on your database and retrieces the suggestion and writes the html internet site and sends that to the customer to apply. trouble-free server element scripting for information superhighway web content often use Hypertext Preprocessor. vast business enterprise business enterprise purposes use Java.

2016-10-31 09:57:33 · answer #3 · answered by gennusa 4 · 0 0

That looks correct to me (except that you're missing the closing double quotes)
I assume that reqOpen is a column in supRequest, right?

2007-01-17 13:22:40 · answer #4 · answered by Anonymous · 1 1

You're not closing the quote. Should read

sql = "SELECT reqOpen FROM supRequest WHERE reqOpen = 'Yes'"

2007-01-17 13:23:23 · answer #5 · answered by Dan 1 · 1 1

if you r using oracle and if your column name are in UNICODE formate then you must use double quote for column name as well as table name. or if you use SQLServer with unicode then you have to use [] for the same.
It may help you.

2007-01-17 22:33:18 · answer #6 · answered by bhaboghure_jhor 2 · 0 1

Try using the <> instead of =
so it would read
SELECT reqOpen FROM supRequest WHERE reqOpen <> 'Yes'

2007-01-17 13:25:26 · answer #7 · answered by Crystaline 3 · 0 3

You say it needs fixing. What is the error?

2007-01-18 03:10:06 · answer #8 · answered by Elizabeth Howard 6 · 0 1

fedest.com, questions and answers