Solved

Concatenate in datagrid

Posted on 2004-08-31
3
340 Views
Last Modified: 2008-03-06
I have a table which has the following fields

Prefix
SheetNumber
WhatFor
ApprovalDate
FabricationDate

If I have two records which both have the same prefix and sheet number but have different WhatFor I only want to display 1 of the records.

Table
Prefix    SheetNumber      WhatFor           Approval Date   Fabrication Date
Ar            100                Approval                01/01/01           01/02/01
AR           100                Fabrication             01/01/01           01/02/01

Datagrid
Prefix      SheetNumber     Approval Date   Fabrication Date
AR               100                  01/01/01          01/02/01

Both records represent the same sheet which will have two records one for approval and one for fabrication, however for this particular datagrid I only need to display the record one time because they have the same dates and whatfor is irrelavent.
0
Comment
Question by:MarkWP
3 Comments
 
LVL 18

Accepted Solution

by:
tusharashah earned 500 total points
ID: 11943100
If you do not need field 'WhatFor' in datagrid, then you can write your query for retriving data like:

>>> "SELECT DISTINCT PREFIX, SheetNumber, ApprovalDate, FabricationDate FROM [TABLE]"

Use of distinct keyword will give you only 1 Record instead of 2.

-tushar

0
 
LVL 3

Expert Comment

by:aravindtj
ID: 11943444

Hi,
try this query,

SELECT DISTINCT Prefix, SheetNumber,  Approval Date,   Fabrication Date FROM <you table name> a, <you table name> b where a.Prefix = b.Prefis and a.SheetNumber = b.SheetNumber and a.WhatFor != b.WhatFor;

All the best.
0
 
LVL 1

Author Comment

by:MarkWP
ID: 11945506
Thanks To All
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now