473,651 Members | 2,835 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MySQL Search Query Help

2 New Member
Can someon show me how to wirte a mySQL search query to search from only the open records. This is what I have but it continues to return records that are closed so I'm obviously doing something wrong. I've also tried, Where Closed = 'N'

Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM my Table
  3. WHERE Closed != 'Y' And Actionee LIKE '%colname%' OR Responsible_Org LIKE '%colname1%' OR Source Like '%colname2%' OR id LIKE '%colname5%'
  4. ORDER BY id ASC
Any direction would be appreciated.
Jul 25 '07 #1
2 1767
mwasif
802 Recognized Expert Contributor
Use paranthesis around all OR clauses
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM my Table
  3. WHERE Closed = 'N' AND (Actionee LIKE '%colname%' OR Responsible_Org LIKE '%colname1%' OR Source LIKE '%colname2%' OR id LIKE '%colname5%')
  4. ORDER BY id ASC
Jul 25 '07 #2
fusonts
2 New Member
Use paranthesis around all OR clauses
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM my Table
  3. WHERE Closed = 'N' AND (Actionee LIKE '%colname%' OR Responsible_Org LIKE '%colname1%' OR Source LIKE '%colname2%' OR id LIKE '%colname5%')
  4. ORDER BY id ASC
That's it! Thank you so much.
Jul 25 '07 #3

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

Similar topics

3
5388
by: joemyre | last post by:
Hi everyone, What I'm trying to do is take php variables i got from user input, and pass them as the MySQL query terms. $query = "select * from ident where ".$searchtype1."=".$searchterm1.""; ERROR: Invalid query: You have an error in your SQL syntax near '=' at line 1
3
3956
by: Mike Cocker | last post by:
Hello, I'm quite weak at PHP, so I was hoping to get some help understanding the below code. First off, I'm trying to create a "query form" that will allow me to display the results on my screen. I grabbed this code from the net hoping that I could tweak it for my needs. I'm using MySQL, PHP and IIS and they all are running fine. As the code is, it will display the form, but it won't display my result(s). Any suggestions? Cheers,
0
5765
by: Phil Powell | last post by:
The table already has a fulltext index and from there I can use the MySQL fulltext search query to get results as well as the relevancy score. The problem I have is that MySQL has a default setting whereby the minimum amount of characters is 4 for a search. Being that we're government and full of TLA (three-letter acronyms), that is not practical, and furthermore, the app I'm building must be fully portable, so having MySQL tweaked...
0
1460
by: Henry Hank | last post by:
Environment: I'm setting up a database server on a Dell Poweredge 2650, dual 1.8GHZ pentium with 1GB of memory and RAID5 drives. I've installed RedHat 9, and updated the kernel to 2.4.20-19.9smp. I've installed the RPM binary distribution of MySQL 4.0.14 right from the MySQL website. The only thing I have done is disable InnoDb in my my.cnf file. Database Table: I have a database with 21.4 million records. One field is a VARCHAR(255)...
1
3010
by: SC | last post by:
I'm developing a site that may eventually have a very large database of users (hopefully, but who knows). It will be a community website where users can search each other (think Friendster, Classmates, every dating site out there, etc.). Often there will be queries with multiple joins and sometimes may include a few fulltext searches. Each page of results will have a limited number of results displayed (obviously). As I understand it,...
8
2356
by: Fred | last post by:
Hello, Our website is currently developed in ASP/Mysql 4. The dedicated servers on which it is currently hosted arrive at saturation. Here is their configuration: - 1 server PIV 2,8Ghz 1GB RAM with IIS 5 on Windows 2000 - 1 server Bi-xeon 3Ghz, 512 MB with MySQL 4 on Windows 2003 The website makes approximately 10.000.000 of pages seen and 310.000
5
2492
by: Martien van Wanrooij | last post by:
I have been using phpdig in some websites but now I stored a lot of larger texts into a mysql database. In the phpdig search engine, when you entered a search word, the page where the search word was found was displayed with about 2 lines before and 2 lines behind the search word itself. Let us say you look for "peanut butter" an the word is found in a larger text about sandwiches, even when it is on the 40th line of the text you would get...
7
3763
by: Ivan Marsh | last post by:
Hey Folks, I'm having a heck of a time wrapping mind around AJAX. Anyone know of a simple, straight-forward example for pulling a simple query from mysql with PHP using AJAX? As I understand it I need a PHP script that pulls the query and dumps the data into XML format, that is called by triggering a javascript event that reads that file with XMLhttprequest.
13
3412
by: Ciaran | last post by:
Hi All, Is it faster to have mySql look up as much data as possible in one complex query or to have php do all the complex processing and submit lots of simple queries to the mysql database? Cheers, Ciarán
9
1996
by: Derrick Shields | last post by:
I'm working with a database that has over 11 million rows. The .SQL drop file is about 2.5gigs. Doing a simple query: select * from people where last_name like '%smith%' A query like this can take up to two minutes. I've spent hours reading these forums and other sites on the internet, and I've figured that I need to do a couple things: create some indexes -and- possibly create some partitions
0
8357
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8700
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
8465
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
8581
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7298
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...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1910
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
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.