473,395 Members | 1,680 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,395 software developers and data experts.

exclude fields in a query

Hi,

Is there a way to exclude fields in a query . If there are 20 fields in a column and you want to see all but 4, and I try the below statement and for some reason I do not get the result I need
select * from dbo.da_accounts where totals_group not like ('cre%','ame%','de%')
select * from dbo.da_accounts where totals_group <> ('cre%','ame%','de%')
select * from dbo.da_accounts where totals_group not in ('cre%','ame%','de%')

Thanks
Jul 22 '10 #1
2 1799
TheServant
1,168 Expert 1GB
I believe you need to separate the WHERE clauses for LIKE searches:
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM dbo.da_accounts WHERE totals_group NOT LIKE ('cre%') OR  totals_group NOT LIKE ('ame%') OR  totals_group NOT LIKE ('de%')
Jul 23 '10 #2
amitpatel66
2,367 Expert 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. select * from dbo.da_accounts where totals_group not in ('cre','ame','de') 
  3.  
Jul 26 '10 #3

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

Similar topics

4
by: Fernand St-Georges | last post by:
I have 16,000 rows in tblClient and 3000 rows in NewTable. SELECT tblClient.* FROM tblClient INNER JOIN ON tblClient.NoDossier <> .NoDossier if I use = (equal) instead of...
8
by: ric | last post by:
Hi, Is there a way to exclude fields in a query other than just including the ones you want. If there are 20 fields and you want to see all but 3, it would be a lot easier to exclude the 3. ...
1
by: EI | last post by:
Hello.. Using Access 2000 I have a table with the following fields: DataId (Extension ID) DataDesc (Description of Extension) I created a Query based on those two fields.
9
by: paul.jameson | last post by:
I have a simple Access database that stores Karaoke Songlists for my local pub. From this you are able to print out the song lists they use. Up until now, any duplicate songs that appear on say,...
4
by: ninrulz | last post by:
I have been working on a database to perform some of the tasks that I have been doing manually in Excel. One of those tasks is to sort and exclude duplicate data. The fields are as follows ...
10
by: sesling | last post by:
I have created a query that will pull information from our database for the operators. This query will pull in on average 50,000 records. The operators need to refine the search results. I have...
5
by: robertmeyer1 | last post by:
Hey, I have 2 append queries. The first is based off of code given and works great. For the second, I followed the format of the 1st and adjusted it to meet my needs. Query 1 works great. It...
8
by: tonsam | last post by:
I have a report (monthly inventory) whose record source is based on a query named monthly_inventory_qry. On same query (monthly_inventory_qry), I add two fields (month_1 and month_2)and its sum was...
13
by: Neil | last post by:
I'm running an update query in SQL 7 from QA, and it runs forever. Has been running for 20 minutes so far! The query is quite simple: update a single field in a table, based on a join with another...
8
by: banderson | last post by:
Hello, I have a combo box in which I want to display multiple fields by concatenating the fields together. If one of those concatenated fields is Null, then the combo box does not show anything. To...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.