A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Deleting information in a query



 
 
Thread Tools Display Modes
  #1  
Old September 3rd, 2008, 08:46 PM posted to microsoft.public.access.queries
guidop12
external usenet poster
 
Posts: 38
Default Deleting information in a query

I have a table that is setup like this
ranking Company Total Revenue
1 ABC 123,456
What I want to do is have a delete query(or something) that just deletes the
contents of the Company and the Total Revenue columns and keep the column
ranking with its information.
The SQL coding is below but that deletes all the rows hence deleting the
ranking information.
DELETE CompanyOneYr.Company, CompanyOneYr.[Total Revenue]
FROM CompanyOneYr;

The ranking column is a permanent set of numbers from 1 to 50
Can someone please advise

  #2  
Old September 3rd, 2008, 08:53 PM posted to microsoft.public.access.queries
Bob Barrows [MVP]
external usenet poster
 
Posts: 441
Default Deleting information in a query

guidop12 wrote:
I have a table that is setup like this
ranking Company Total Revenue
1 ABC 123,456
What I want to do is have a delete query(or something) that just
deletes the contents of the Company and the Total Revenue columns and
keep the column ranking with its information.
The SQL coding is below but that deletes all the rows hence deleting
the ranking information.
DELETE CompanyOneYr.Company, CompanyOneYr.[Total Revenue]
FROM CompanyOneYr;

The ranking column is a permanent set of numbers from 1 to 50
Can someone please advise


What you want to do is update the columns:

update CompanyOneYr
set Company = ''.[Total Revenue] = Null

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


  #3  
Old September 3rd, 2008, 09:15 PM posted to microsoft.public.access.queries
MGFoster
external usenet poster
 
Posts: 653
Default Deleting information in a query

guidop12 wrote:
I have a table that is setup like this
ranking Company Total Revenue
1 ABC 123,456
What I want to do is have a delete query(or something) that just deletes the
contents of the Company and the Total Revenue columns and keep the column
ranking with its information.
The SQL coding is below but that deletes all the rows hence deleting the
ranking information.
DELETE CompanyOneYr.Company, CompanyOneYr.[Total Revenue]
FROM CompanyOneYr;

The ranking column is a permanent set of numbers from 1 to 50
Can someone please advise


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The DELETE command deletes the whole row. What you want is the UPDATE
command. Ex:

UPDATE CompanyOneYr
SET Company = NULL,
[Total Revenue] = NULL

This will set the values for columns "Company" and "Total Revenue" to
NULL values (blanks) for the entire table. If you just want to clear
certain rows add the WHERE clause to the command:


UPDATE CompanyOneYr
SET Company = NULL,
[Total Revenue] = NULL
WHERE ranking IN (1,5,7)

This will NULL the columns for rankings 1, 5, and 7.

--
MGFoster:::mgf00 at earthlink decimal-point net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSL7wYYechKqOuFEgEQKYawCZAWg3meJJoyQzZU0AMZnVyv 0rIQsAnRiX
uu8Afn8uv3lIK9PblSeihjgS
=KMBR
-----END PGP SIGNATURE-----
  #4  
Old September 3rd, 2008, 09:20 PM posted to microsoft.public.access.queries
guidop12
external usenet poster
 
Posts: 38
Default Deleting information in a query

I tell you, you guys are great
Thank you very much

"Bob Barrows [MVP]" wrote:

guidop12 wrote:
I have a table that is setup like this
ranking Company Total Revenue
1 ABC 123,456
What I want to do is have a delete query(or something) that just
deletes the contents of the Company and the Total Revenue columns and
keep the column ranking with its information.
The SQL coding is below but that deletes all the rows hence deleting
the ranking information.
DELETE CompanyOneYr.Company, CompanyOneYr.[Total Revenue]
FROM CompanyOneYr;

The ranking column is a permanent set of numbers from 1 to 50
Can someone please advise


What you want to do is update the columns:

update CompanyOneYr
set Company = ''.[Total Revenue] = Null

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.