473,657 Members | 2,554 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,an d SQL Support, all in one place.
Jul 19 '05 #1
6 1767
On 15 Sep 2003 15:52:14 GMT, Andrew J Durstewitz
<ad******@devbu ilder.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******@devbu ilder.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,an d 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,an d 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,an d 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,an d 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,an d 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
33863
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 capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
41
2852
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
4375
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 = 1 >>> i
5
9877
by: Spencer | last post by:
Field Names: NOs Code Code1a UniqueID 61 10 888 10 62 10 888 11 63 10 888 12 Logic: If Count(code >1) & Count (Code1a >1) Update the (Nos) to EQUAL the same Value. ALL the Nos for the above examble should be the same value for all three records whether it's 61 for...
1
1230
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 call tbComplInfo). tbComplInfo has a subform(sbfrmComplaintInfo), on it, that subform has two dropdowns(names-cboStatus, cboStatDesc). The values displayed in the second dropdown are dependant on the value chosen in the first dropdown. So, in the...
177
6982
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 programming languages still being designed with C's syntax? These questions drive me insane. Every waking minute...
16
1754
by: danu | last post by:
I have a structure : typedef struct{ char magicNum; int width; int height; int maxGrey; int pixels; } ImageT;
7
2504
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 Python?
33
2055
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 days to learn all those changes! I can see it fixes several of the missing things/problems I have found in Python in the past, like the lack of information regarding the floating point it uses, etc. I have seen that many (smart) updates are from...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8730
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7321
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.