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

select statement help

Hi all,

Just a newbie to SQL

on the categories column, I want to run a select statment that shows me all the categories in the column. Any clue please.
Sep 23 '07 #1
4 1095
ck9663
2,878 Expert 2GB
Hi all,

Just a newbie to SQL

on the categories column, I want to run a select statment that shows me all the categories in the column. Any clue please.
could you be a little more specific?
Sep 23 '07 #2
Shashi Sadasivan
1,435 Expert 1GB
Hi all,

Just a newbie to SQL

on the categories column, I want to run a select statment that shows me all the categories in the column. Any clue please.
Expand|Select|Wrap|Line Numbers
  1. Select categories from yourTable
Is that all you are looking for?
Sep 23 '07 #3
Not sure exactly what you are asking. If you want to see the value of a field called 'Category' for every record in the table you would do this:


SELECT Category
FROM YourTableNameHere

If you only want to see the unique Category values (Lets say there are three records in your table and for the Category field each have the same value of 'Customer' then my quesry above would list Customer three times, each record has the same value. If you only want to see this value one time you would do the following:

SELECT DISTINCT Category
FROM YourTableNameHere

Does this answer your question?

If you want to select the Category field but only display records that have a (AS AN EXAMPLE) ContactClass (You probably don't have this field but you will get the idea) of 'Customer' then you would write:

SELECT Category
FROM YourTableNameHere
WHERE ContactClass = 'Customer'

You would change out ContactClass with any field you want to filter by and then = 'Whatever Value you Want to Filter'

On the Select line you can add the distinct clause to not repeat a Category value.
Sep 24 '07 #4
Sorry guys for a bit confusion. I didn't explain my question well.

Select Distinct solved my problem.

thank you all.
Sep 24 '07 #5

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

Similar topics

5
by: jayson_13 | last post by:
Hi, I need to implement a counter and i face problem of locking so hope that u guys can help me. I try to do test like this : 1st connection SELECT * FROM nextkey WHERE tblname = 'PLCN'...
2
by: Edwinah63 | last post by:
Hi Everyone, All the very best for 2004!! i need urgent help with this problem, the users are about to skin me alive!! we have an access front end with linked to sql server 2k tables. ...
1
by: brett | last post by:
Here is my SQL string: "SELECT to_ordnum, to_orddate," _ & "(SELECT SUM((DDPROD.pr_stanmat * DDPROD.pr_prfact) * (DOBOM2.b2_quant * DDORD.or_quant)) FROM DDPROD INNER JOIN DOBOM2 ON...
3
by: dumbledad | last post by:
Hi All, I'm confused by how to replace a SELECT statement in a SQL statement with a specific value. The table I'm working on is a list of words (a column called "word") with an index int...
7
by: CharlesEF | last post by:
Hi All, I have run into another problem that is eating my lunch. Should be simple but I am having one heck of a time. Please look at this SELECT statement: SELECT FROM States WHERE ] =...
2
by: GIS Analyst | last post by:
Hi to all I wish to be able to have a standard select statement which has additional fields added to it at run-time based on supplied parameter(s). ie declare @theTest1 nvarchar(10) set...
12
by: TP | last post by:
Here is my problem. I need to display a table about which I have no information except the table name. Using metadata I can somehow show the column names and record values. But my table has 1...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
5
by: Daniel Wetzler | last post by:
Dear MSSQL experts, I use MSSQL 2000 and encountered a strange problem wqhile I tried to use a select into statement . If I perform the command command below I get only one dataset which has...
2
by: kxyz | last post by:
Hello everyone, I need help with a stored procedure or two. My stored procedures are supposed to check if a certain record exists. If it does exist, then I select everything from that row, as...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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...
0
Oralloy
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,...
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...

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.