Hello Everyone,
I am looking for some help again....
So my table has CompanyID, companyname, companytype, address, Phone, and Fax etc...
I want to extract records that only have phone no. and nothing else. My query is giving me all companies that have phone so it's including fax, address etc. which i don't to see. i want the query to return the companyids that have phone numbers only.
Any help on this much appreciated,
Thanks,
S
4 1111 michaelb 534
Recognized Expert Contributor
Try this: -
SELECT * from myTable WHERE Phone is not null AND
-
(CompanyID is null and companyname is null
-
and companytype is null and address is null and Fax is null);
-
Depending on your situation (the database you use and how values are collected and inserted) you may need to replace
"field is null" with field = '' // two single quotes
and
"field is not null" with field != ''
thanks for the quick response. my table has over 300 fields so i would have to do the null or '' for each. is there a faster way to do this?
michaelb 534
Recognized Expert Contributor
Nothing I can think of.
Of course you can create a view and list all these columns only once, then just do a select from view Keep in mind that you are going to do a full table scan, so if your table is large it may take a while for this query to complete.
You may need to address this issue elsewhere, it does not seem reasonable that application allowed to insert these records on the first place.
Nothing I can think of.
Of course you can create a view and list all these columns only once, then just do a select from view Keep in mind that you are going to do a full table scan, so if your table is large it may take a while for this query to complete.
You may need to address this issue elsewhere, it does not seem reasonable that application allowed to insert these records on the first place.
yeah. thanks for the help!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jack |
last post by:
I have a text file of data in a file (add2db.txt) where the entries are
already entered on separate lines in the following form:
INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great...
|
by: lkrubner |
last post by:
I have a webserver through Rackspace. I create a domain. I create an
FTP user. I upload some files. I create a database called
testOfSetupScript and then I create a database user named setup.
I...
|
by: Chad Richardson |
last post by:
Is there a way in SQL Server 2000 to extract data from a table, such that
the result is a text file in the format of "Insert Into..." statements, i.e.
if the table has 5 rows, the result would be 5...
|
by: ward |
last post by:
Greetings.
Ok, I admit it, I bit off a bit more than I can chew.
I need to complete this "Generate Report" page for my employer and I'm
a little over my head. I could use some additional...
|
by: Bombus |
last post by:
Hello.
I have two different types of MS Access databases (A.mdb). One is on a server, and several databases at clients (B.mdb).
Now I want to develop some code that can extract data from the...
| |
by: Fabian Braennstroem |
last post by:
Hi,
I would like to remove certain lines from a log files. I had
some sed/awk scripts for this, but now, I want to use python
with its re module for this task.
Actually, I have two different...
|
by: Paulers |
last post by:
Hello,
I have a log file that contains many multi-line messages. What is the
best approach to take for extracting data out of each message and
populating object properties to be stored in an...
|
by: napolpie |
last post by:
DISCUSSION IN
USER nappie writes:
Hello, I'm Peter and I'm new in python codying and I'm using parsying
to extract data from one meteo Arpege file. This file is long file and
it's composed by...
|
by: ndedhia1 |
last post by:
I have data in a database that looks like this:
INSERT INTO ALARMNOTIFICATIONDETAIL VALUES ('1865', '2295', '15401', '1', 'Prodprdcons11InstrumentationMonitor', 'ALL');
INSERT INTO...
|
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...
|
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...
| |
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,...
|
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...
|
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...
|
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: 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,...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 ...
| |