473,408 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Does MySQL support something like an "OR" statement?

Samishii23
246 100+
I came across something in my code today that made me wonder if theres a way to basicly incorporate two statements into one using something like a "OR" logic.

Basicly something like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM `table` WHERE `user` = "someUser" OR WHERE `email` = "something@bs.com"
Don't bite my head off, i'm sure thats not proper MySQL syntax, just trying to get my point across.

Thanks in advance.
Feb 19 '11 #1

✓ answered by NetDynamic

Well other than your quotes being the wrong type that is exactly what the query looks like except the 2nd WHERE

Here its is::

SELECT * FROM table WHERE user = 'someUser' OR email = 'something@bs.com'

7 2113
Well other than your quotes being the wrong type that is exactly what the query looks like except the 2nd WHERE

Here its is::

SELECT * FROM table WHERE user = 'someUser' OR email = 'something@bs.com'
Feb 19 '11 #2
Samishii23
246 100+
Thanks. And my quotes work fine. Been using them for 2+ years, never had a problem.
Feb 19 '11 #3
portability, but w/e
Feb 19 '11 #4
Samishii23
246 100+
Portability? What doesn't use those quotes? Is it something in the MySQL config?
Feb 19 '11 #5
I know some windows servers will error when using ", just saying.
Feb 19 '11 #6
Samishii23
246 100+
Hmm. Thanks for the heads up!
Feb 19 '11 #7
Yes, you could use or in sql syntax. Just cut the second WHERE off and correct the quoting stuff. Like this..

Expand|Select|Wrap|Line Numbers
  1. select * from 'table' where user = 'someUser' or email = 'someEmail@yy.com'
Feb 19 '11 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: tdi | last post by:
Ok, stupid question for the day. I'm reading the interview with Steve Moret and he says: "Once a lot of scripts started going in we knew there was no way we could back out of using Python." I'm...
7
by: Roberta McGervey | last post by:
I have the following code: <Script LANGUAGE=vbscript RUNAT=Server> for i =0 to document.form1.elements.count-1 response.write "test" next
1
by: mike | last post by:
Ok, I have a page that queries a database and retrieves values to create a custom report in ms excel format on the fly so that it can be downloaded. I can use the following sub to generate the...
4
by: Smitro | last post by:
Hi, How come in some statements I can use: If (something) or DIE(); but other times it won't work (returns an error) unless I take out the OR. Is there any documentation on this anywhere?
4
by: Bradley Plett | last post by:
I have what should be a trivial problem. I am using XMLSerializer to serialize an object. It serializes boolean values as "True" and "False". I then want to use an XSLT on this XML, and I want...
0
by: Serdge Kooleman | last post by:
C# 2005 how to remove warning "The file 'C:\Main.cs' does not support code parsing or generation because it is not contained within a project that supports code. i created the web project...
1
by: kamleshsharmadts | last post by:
I am using Ajax with struts in web application. from jsp i am calling a function of ajax.js onclick of a button. code of that call function which calling from jsp given as below:- ...
37
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
1
by: oanhhuynh | last post by:
Hi, I'm designing 1 form include 2 Unbound Object Frame to insert image and memo that describe the product. On database in Access have 2 fields image and description with OLE Object property ...
5
by: monu121 | last post by:
hi, i am getting one error "Object Does Not Support This Property or Method..." when i am using my dll file actuly i am calling my dll file in product. i am using vb 6.0. if any one is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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,...
0
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...

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.