473,387 Members | 1,779 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.

Count in teradata

Hello,

Will you be able to help me in achieving my expected outcome?
Table 1 shows sampler items and the corresponding names, what I would like to achieve is that, i'll be able to count the number of sampler items regardless of the corresponding names (see expected outcome table).

**Note just disregard the single quotes (use for spacing purposes)



Table

sampler ' ' name
sample1 ' ' oyster
sample2 ' ' shrimp
sample3 ' ' pork
sample3 ' ' beef
sample4 ' ' chicken


expected outcome

sampler ' ' name ' ' sampler count
sample1 ' ' oyster ' ' 1
sample2 ' ' shrimp ' ' 1
sample3 ' ' pork ' ' 2
sample4 ' ' chicken ' ' 1
Sep 8 '09 #1
1 3298
amitpatel66
2,367 Expert 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT x.sampler,(SELECT name from table_name WHERE sampler = x.sampler AND ROWNUM < 2) name, Sampler_Count FROM
  3. (SELECT sampler, COUNT(*) Sampler_Count from table_name GROUP BY sampler) x
  4.  
  5.  
I notice that in the expected output, you want to fetch the name (either of the one) in case there are more than one record for a particular sampler (in example here sampler3).
Sep 8 '09 #2

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

Similar topics

0
by: Paul Watson | last post by:
Is there a DB-API for Teradata? Is there any access to Teradata?
0
by: mgnmsoft | last post by:
Looking for experienced Teradata DBA with experience in conversion from Oracle to Teradata. US. Citizens needed for this position. Client will apply for Top Secret clearance. Please email resume at...
1
by: Michael L. | last post by:
hi everyone, It is relatively easy to translate RANK() from teradata to DB2, but I get to a glitch when I realize what Qualify RANK does. I know that there are a lot of experienced DB2...
12
by: jdokos | last post by:
Does anyone know of any good sources (white papers, etc.) regarding migrating from Teradata to DB2 UDB EEE? We are in the very beginning stages of investigating this as an option for some of the...
3
by: nolanmadson | last post by:
I'm creating a front-end for some Teradata user maintenance tables in MS Access. I've started having problems in occasionally not being able to insert or update records in these tables. I've been...
1
by: terrordata | last post by:
Hey... i have a major doubt. is it possible to use an insert command in a loop while inserting data into a teradata table from java? if so can someone please give me the syntax?
2
by: mohanpadamata | last post by:
Hi frnds, I am searching for teradata material.its an urgent requirement in my project. i couldnt find materila to learn it.i dont have even a document.plz help me in this regard.if anyone has plz...
4
by: resmi318 | last post by:
I am running a query similar to given below. CREATE TABLE ABC_08 AS (SELECT x.col1, trim(x.col2), x.col3, x.col4, x.col5 FROM Table1 x
4
by: KMEscherich | last post by:
Version of Access = 2003 Hi there, is there a way to capture data using TERADATA SQL Assistant and import a portion of this database table into a Microsoft Access database table??? I currently...
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:
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.