Concatenate in datagrid

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


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.

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

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.
Question by:MarkWP
LVL 18

Accepted Solution

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.



Expert Comment

ID: 11943444

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.

Author Comment

ID: 11945506
Thanks To All

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
creating threads in delphi 1 82
detecting  the added row index in a datagridview 3 54
Base1 Encode/Decode 3 67
Is doing teaching in my situation advisable? 2 50
Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

919 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

17 Experts available now in Live!

Get 1:1 Help Now