473,503 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP/SQL Syntax Brain FART!

Hey, could someone remind me how to do this?

I want to select a client from TABLE1 where their sub_id is equal to 'O'
or 1?

For some reason I forgot how to do this in one statement.

Thanks,
Andrew J Durstewitz
http://www.devbuilder.org

DEVBuilder.org, http://www.DEVBuilder.org
ASP,ASP.NET,VB.NET,PHP,Java,and SQL Support, all in one place.
Jul 19 '05 #1
6 1763
On 15 Sep 2003 15:52:14 GMT, Andrew J Durstewitz
<ad******@devbuilder.org> wrote:
Hey, could someone remind me how to do this?

I want to select a client from TABLE1 where their sub_id is equal to 'O'
or 1?

For some reason I forgot how to do this in one statement.


select xxx from Table1 Where sub_id = 0 or sub_id = 1
or
select xxx from Table1 where sub_id in (0, 1)
Jul 19 '05 #2
What datatype is sub_id? How can it possibly be an 'O' or a 1?

Anyway, you can use an OR clause, like

WHERE sub_id=0 OR sub_id=1

Or you could use an IN list, like

WHERE sub_id IN ('O', 'something')

"Andrew J Durstewitz" <ad******@devbuilder.org> wrote in message
news:3f***********************@news.frii.net...
Hey, could someone remind me how to do this?

I want to select a client from TABLE1 where their sub_id is equal to 'O'
or 1?

For some reason I forgot how to do this in one statement.

Thanks,
Andrew J Durstewitz
http://www.devbuilder.org

DEVBuilder.org, http://www.DEVBuilder.org
ASP,ASP.NET,VB.NET,PHP,Java,and SQL Support, all in one place.

Jul 19 '05 #3
I understand the OR statement but I need to it to be a match of 2 or 3
items.

client MUST = strClient
sub_id MUST = 'O' or 1

See what I mean?

Something like...

Select * from TABLE1 where client = strClient and (sub_id = 'O' or
sub_id = 1)

I think that's the wrong syntax, that is why I am having a problem.

thx,
Andrew

DEVBuilder.org, http://www.DEVBuilder.org
ASP,ASP.NET,VB.NET,PHP,Java,and SQL Support, all in one place.
Jul 19 '05 #4
I don't think you said that in your first post.
Did you try the statement you posted? It looks like what you want except
the 1 should be in quotes (as I assume sub_id is a char or varchar)
"SELECT client, sub_id FROM client WHERE (client='" & strClient & "') AND
(sub_id='O' OR sub_id='1')"

I added the paranthesis for clarity.

"Andrew J Durstewitz" <ad******@yahoo.com> wrote in message
news:3f***********************@news.frii.net...
I understand the OR statement but I need to it to be a match of 2 or 3
items.

client MUST = strClient
sub_id MUST = 'O' or 1

See what I mean?

Something like...

Select * from TABLE1 where client = strClient and (sub_id = 'O' or
sub_id = 1)

I think that's the wrong syntax, that is why I am having a problem.

thx,
Andrew

DEVBuilder.org, http://www.DEVBuilder.org
ASP,ASP.NET,VB.NET,PHP,Java,and SQL Support, all in one place.

Jul 19 '05 #5
Why do you think it is the wrong syntax? Show some data and desired
results.
Is sub_id a text field or numeric? You are trying to select either text or
numeric from a field which is it?

Select * from TABLE1 where client = strClient and (sub_id = 0 or
sub_id = 1)

or
Select * from TABLE1 where client = strClient and (sub_id = 'O' or
sub_id = '1')
Mike
"Andrew J Durstewitz" <ad******@yahoo.com> wrote in message
news:3f***********************@news.frii.net...
I understand the OR statement but I need to it to be a match of 2 or 3
items.

client MUST = strClient
sub_id MUST = 'O' or 1

See what I mean?

Something like...

Select * from TABLE1 where client = strClient and (sub_id = 'O' or
sub_id = 1)

I think that's the wrong syntax, that is why I am having a problem.

thx,
Andrew

DEVBuilder.org, http://www.DEVBuilder.org
ASP,ASP.NET,VB.NET,PHP,Java,and SQL Support, all in one place.

Jul 19 '05 #6
Thanks guys, it's working now. Just had some syntax errors on my side
it looks.

Thank you,
Andrew

DEVBuilder.org, http://www.DEVBuilder.org
ASP,ASP.NET,VB.NET,PHP,Java,and SQL Support, all in one place.
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
33322
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
41
2809
by: John Marshall | last post by:
How about the following, which I am almost positive has not been suggested: ----- class Klass: def __init__(self, name): self.name = name deco meth0: staticmethod def meth0(x):
7
4370
by: Petr Prikryl | last post by:
Hi, Summary: In my opinion, the C-like prefix increment and decrement operators (++i and --i) should be marked as "syntax error". Current situation: try... (Python 2.4 (#60, ...)) >>> i =...
5
9869
by: Spencer | last post by:
Field Names: NOs Code Code1a UniqueID 61 10 888 10 62 10 888 11 63 ...
1
1221
by: vulcaned | last post by:
Hi All, Need help with the right statement for the following situation. In Access97 I have a Form(frmComplaintUpdate) which has a Tab Control(called TabCtl987) with several tabs(first tab we'll...
177
6852
by: C# Learner | last post by:
Why is C syntax so uneasy on the eye? In its day, was it _really_ designed by snobby programmers to scare away potential "n00bs"? If so, and after 50+ years of programming research, why are...
16
1745
by: danu | last post by:
I have a structure : typedef struct{ char magicNum; int width; int height; int maxGrey; int pixels; } ImageT;
7
2491
by: braver | last post by:
Greetings -- as a long time user of both Python and Ruby interpreters, I got used to the latter's syntax-coloring gem, wirble, which colorizes Ruby syntax on the fly. Is there anything similar for...
33
2027
by: bearophileHUGS | last post by:
I have just re-read the list of changes in Python 2.6, it's huge, there are tons of changes and improvements, I'm really impressed: http://docs.python.org/dev/whatsnew/2.6.html I'll need many...
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.