Setting That Disallows Duplicate Values In A Column?

Jul 19, 2007

Is there a setting in SQL Server that ensures a column is not allowed to have the same value more than once? Or must this be set up in the insert statment itself? Or how about a business rule?

View 2 Replies


ADVERTISEMENT

Duplicate Values In A Column.....URGENT!!

May 9, 2000

We have a table with 1 million rows with duplicates in a column which allows nulls.Can we enforce uniqueness for only future inserts by anyway(ignoring the old ones)?
Thanks!

View 3 Replies View Related

Removing Duplicate Delimited Values From A Single Column?

Jun 18, 2014

I have a stored procedure that returns a single row based on a parameter of employee ID. This particular procedure uses a CTE to traverse our org structure. One of the columns is returning a delimited string of Windows login values and due to the business rules, it can contain duplicate values. I need to have that column contain only unique values - no dupes.

For example, this one column could contain something like this:

domainuser1;domainuser2;domainuser2;domainuser 3;

The need is to convert to this:

domainuser1;domainuser2;domainuser3;

I know that's a tall order.

View 1 Replies View Related

SQL Server 2012 :: Reducing Duplicate Row Because Of Different Column Values?

Oct 14, 2014

With the data example below I am trying to consolidate the duplicate rows by flattening the dealer and billcode, or putting those values in each of the columns instead of creating separate rows...

74 MARTHA PATNE RIPLEY 1 23,327,76 ROTTINGDAM AAC SPRINGFIELD 3052 USA MPATRIP@AMERICANALARM.COM,MPATRIP@COMCAST.NET,PRIPLEY@ONECOMMUNICATIONS.COM

[table]
arnumbercustomernamedealerbillcodeaddl_addraddr1addr2branchcityzipcodecountryemaildefaultEmail
39SUSAN THALKER 2271BOTTOMWOOD RDAACHAMMOND02180-2703USASUWS3@COMCAST.NET1
56ANN REBELLO 123SHERIDAN AVEAACMEDFORD2155USANULLNULL
58DARRELL/PATTI SANDERS 6020DOTY AVENUEAACDANVERS1923USANULLNULL
74MARTHA PATNE RIPLEY 123ROTTINGDAM DRAACSPRINGFIELD3052USAMPATRIP@AMERICANALARM.COM1
74MARTHA PATNE RIPLEY 1327ROTTINGDAM DRAACSPRINGFIELD3052USAMPATRIP@COMCAST.NET1
74MARTHA PATNE RIPLEY 176ROTTINGDAM DRAACSPRINGFIELD3052USAPRIPLEY@ONECOMMUNICATIONS.COM1
[/table]

View 1 Replies View Related

Transact SQL :: Group By Count Once For Duplicate Column Values?

Oct 1, 2015

My data is like below: 
 
ClassId ClassName   StudentId   Subject     SubjectId 
1         ESL       12         English      20 
1         ESL       13         Science     30 
1         ESL       12         Social       40 
1         ESL       12         Maths        50 
 
Required output: parameters are Subject column values 

ClassId ClassName   TotalStudents   SubjectIds  
 
1        ESL                     1              20, 40, 50 
1        ESL                     1              30 
 
When one student takes multiple subjects then count student only once, so in the above data 12 is one student id takes multiple subjects so counted only once. TotalStudents value is 1
 
I did write below query: 
 
Declare @subjectids string 
set @subjectids = '20,30,40,50' 

-- will split @subjectids  and store in temp table    

select classname, classid, Count(Distinct StudentId) 
from mytable 
where SubjectsIds in @subjectIds 
group by ClassId, ClassName, SubjectId, 
 
but it gives me below output:   

ClassId ClassName   TotalStudents   SubjectIds 
 
1        ESL        1              20 
1        ESL        1              30 
1        ESL        1              40 
1        ESL        1              50 

View 9 Replies View Related

Transact SQL :: Removing Duplicate Values In ID Column Of Table

Oct 14, 2015

I need write a query for removing duplicates, for Example in my table I have columns

A_ID name id
1 sam 10
2 sam 10
3  sam 10
4 sam 10
5  ccc 15
6 ccc 15
7  ccc 15
8 fff 20
9 fff 20
10 fff 20

So now I have duplicates values in id column so now I need to take only one value of each and delete the remaining. I need to take first id value 10,15,20 so only 3 rows should be there in my table.

View 4 Replies View Related

Power Pivot :: Relationship Cannot Be Created Because Each Column Contains Duplicate Values

Nov 15, 2011

I have 2 excel tables files.One table has info about sales by country, by model, by date...and the other table has units by date.Obviously, the common key is "date"....and by creating a relationship, I can add "units" to my combined resulting table.However, I can't create the relationship. Excel keeps telling me: "the relationship cannot be created because each column contains duplicate values. Select at least one column that contains only unique values".

View 15 Replies View Related

Setting Duplicate Fields To NULL

Mar 19, 2008



I have a result set stored in a temporary table variable. The fields need to have heirarchy when they finaly get displayed to the user. I need to replace the repeating fields per group with NULL and leave out only one set of unique records per group.

I want to do something like this- make the fields in red NULL while leaving out the ones in green.

{ Col.Group I } { Col. Group II }

Col1 Col2 Col3 Col4 Col5
------- ------- ------- ------- -------
ValA ValA2 ValA3 ValA40 ValA50 {
ValA ValA2 ValA3 ValA40 ValA50 Row. Group A
ValA ValA2 ValA3 ValA41 ValA51 }

ValB ValB2 ValB3 ValB40 ValA50 { Row. Group B
ValB ValB2 ValB3 ValB41 ValA51 }



I was able to achieve this by using @@ROWCOUNT with in a while loop by performing one UPDATE at a time (SET ROWCOUNT = 1). But i have to run Count(*) each time I loop through the update query to figure out the remaining number of rows I have per group as I need to leave out one untouched. But the Count function is taking too much time and I'm having performace issues.

Any idea how I might be able to do this in my stored proc. efficiently?

Thanks,

Samtadsh

View 8 Replies View Related

Seeing Duplicate SQL Servers, When Setting Up ODBC Connection

Mar 1, 2006

When setting up an ODBC connection on a non-sql Server X and choosing from the drop down menu which SQL Server to connect to, I see two identical names for my SQL Server (Y). No matter which one I choose, Im not able to go to the screen after being asked how I want to log in (SQL server authentication)

If I build a ODBC connection from any other desktop, I only see one SQL Server Y, and am able to establish a connection to SQL Server Y, with the same user account and password as when Im on Server X.

Server X has two network cards and is teamed...could that be a possible problem ?

Any ideas ?...Thank you

View 7 Replies View Related

Reporting Services :: Count Values In A Column Based Upon Distinct Values In Another Column In SharePoint List

Sep 7, 2015

We have SharePoint list which has, say, two columns. Column A and Column B.

Column A can have three values - red, blue & green.

Column B can have four values - pen, marker, pencil & highlighter.

A typical view of list can be:

Column A - Column B
red  - pen
red - pencil
red - highlighter
blue - marker
blue - pencil
green - pen
green - highlighter
red  - pen
blue - pencil
blue - highlighter
blue - pencil

We are looking to create a report from SharePoint List using SSRS which has following view:

                    red     blue   green
    pen            2       0      1
    marker       0       1      0
    pencil          1       3      0
    highlighter  1       1      1 

We tried Sum but not able to display in single row.

View 2 Replies View Related

Integration Services :: SSIS Package - Replacing Null Values In One Column With Values From Another Column

Sep 3, 2015

I have an SSIS package that imports data from an Excel file, replaces any value in Excel that reads "NULL" to "", then writes the data to a couple of databases.

What I have discovered today, is I have two columns of dates, an admit date and discharge date column, and what I need to do is anywhere I have a null value in the discharge date column, I have to replace it with the value in the admit date column. 

I have searched around online and tried a few things using the Replace funtion in Derived columns but no dice so far. 

View 3 Replies View Related

Add Symbol To Column Values And Convert Column Values To Western Number System

Feb 12, 2014

I want to add $ symbol to column values and convert the column values to western number system

Column values
Dollar
4255
25454
467834

Expected Output:
$ 4,255
$ 25,454
$ 467,834

My Query:
select ID, MAX(Date) Date, SUM(Cost) Dollars, MAX(Funded) Funding from Application

COST is the int datatype and needs to be changed.

View 2 Replies View Related

How To Insert Values Without Duplicate Values?

Apr 8, 2008

Hi,
 
I want to insert data into table without duplicate values ..
 
how to do?

View 5 Replies View Related

Error Number For Duplicate Column Value During An Insert For A Unique Column ?

Jul 27, 2007

I have a table in which a non-primary key column has a unique index on it.
If I am inserting a record into this table with a duplicate column value for the indexed column, then what will be the error number of the error in above scenario? OR How could I find this out?
 

View 2 Replies View Related

Duplicate Values

Apr 14, 2004

I have a table which is a license holder table (i.e., plumbers, electricians etc...) There are some people who appear in the table more than once as they have more than 1 type of license. I am tasked with querying out 200 of these people a week for mailing a recruitment letter which I am doing using the following select statement:

SELECT TOP 200 Technicians.Name, Technicians.Address, Technicians.City, Technicians.State, Technicians.ZipCode, Technicians.LicenseType
FROM Technicians

My problem is that this doesn't deal with the duplicates and distinct won't work because I need to pass the license type and that's the one field that's always distinct while the name and adress fields duplicate.

View 8 Replies View Related

Duplicate Values...

Feb 8, 2007

I'm ok at SQL, but this has really confused me - please help!

I've got a table which (amongst others) has two columns - myID, and barcode. Ideally myID and barcode should be a 1 to 1 relationship... but it's not. So how can I get a list of all rows where 1 barcode value has >1 myID? (and also vice versa if possible). Thanks!

View 5 Replies View Related

Duplicate NAME Values

Oct 12, 2007



Hi Guys!

I am trying to figure out a query to which the logic is simple, but I'm missing some basic SQL skill or technique somewhere.....

I have a table called NAME, from which I want to display the following columns:

namecode name Postaladdress

(there's a column called NAME as well as the table being called name incase your wondering)...

I'm concerned with the namecode and name columns for now....

I want to find duplicate name values from the table, how do I do this?

for example, in name, I have the value 'Long water Beach' appear twice. I want the query to show me how many times this appears from this table (duplicate values??)

Both namecode and name are navchar datatypes. So far I tried something like:


select name, namecode, postaladdress
from name
where name in
(select name
from name
group by name, namecode, postaladdress
having count(name) > 1)


I guess we can focus on the subquery here, but I just need that function or code which shows me the duplicate values!! I know its something staring me in the face, but I just can't see it!!

Any help please???

Much appreciated


View 6 Replies View Related

Need To Store Duplicate Values To DB

May 7, 2007

Hi,I have written a stored procedure to store values from a report i generated to the DB. Now there is a column PKID which is the primary key but also needs to be repeated at times. I tried to clear the memory that the same PKID has already been entered for which I wrote another SP.  SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[spCRMPublisherSummaryUpdate](    @ReportDate smalldatetime,    @SiteID int,    @DataFeedID int,    @FromCode varchar,    @Sent int,    @Delivered int,    @TotalOpens REAL,    @UniqueUserOpens REAL,    @UniqueUserMessageClicks REAL,    @Unsubscribes REAL,    @Bounces REAL,    @UniqueUserLinkClicks REAL,    @TotalLinkClicks REAL,    @SpamComplaints int,    @Cost int)ASSET NOCOUNT ON    DECLARE @PKID INTDECLARE @TagID INTSELECT @TagID=ID FROM Tag WHERE SiteID=@SiteID AND FromCode=@FromCodeSELECT @PKID=PKID FROM DimTag WHERE TagID=@TagID AND StartDate<=@ReportDate AND @ReportDate< ISNULL(EndDate,'12/31/2050')IF @PKID IS NULL BEGIN    SELECT TOP 1 @PKID=PKID FROM DimTag WHERE TagID=@TagID AND SiteID=@SiteIDDECLARE @LastReportDate smalldatetime, @LastSent INT, @LastDelivered INT, @LastTotalOpens Real, @LastUniqueUserOpens Real, @LastUniqueUserMessageClicks Real, @LastUniqueUserLinkClicks Real, @LastTotalLinkClicks Real, @LastUnsubscribes Real, @LastBounces Real, @LastSpamComplaints INT, @LastCost INT SELECT @Sent=@Sent-Sent,@Delivered=@Delivered-Delivered,@TotalOpens=@TotalOpens-TotalOpens,@UniqueUserOpens=@UniqueUserOpens-UniqueUserOpens,@UniqueUserMessageClicks=@UniqueUserMessageClicks-UniqueUserMessageClicks,@UniqueUserLinkClicks=@UniqueUserLinkClicks-UniqueUserLinkClicks,@TotalLinkClicks=@TotalLinkClicks-TotalLinkClicks,@Unsubscribes=@Unsubscribes-Unsubscribes,@Bounces=@Bounces-Bounces,@SpamComplaints=@SpamComplaints-SpamComplaints,@Cost=@Cost-Cost    FROM CrmPublisherSummary        WHERE @LastReportDate < @ReportDate        AND SiteID=@SiteID        AND TagPKID=@PKIDUPDATE CrmPublisherSummary SET    Sent=@Sent,    Delivered=@Delivered,    TotalOpens=@TotalOpens,    UniqueUserOpens=@UniqueUserOpens,    UniqueUserMessageClicks=@UniqueUserMessageClicks,    UniqueUserLinkClicks=@UniqueUserLinkClicks,    TotalLinkClicks=@TotalLinkClicks,     Unsubscribes=@Unsubscribes,    Bounces=@Bounces,    SpamComplaints=@SpamComplaints,    Cost=@Cost,    TagID=@TagID    WHERE ReportDate=@ReportDate        AND SiteID=@SiteID        AND TagPKID=@PKIDENDELSE        INSERT INTO CrmPublisherSummary(    ReportDate, SiteID, TagPKID, Sent, Delivered, TotalOpens, UniqueUserOpens,     UniqueUserMessageClicks, UniqueUserLinkClicks, TotalLinkClicks, Unsubscribes,     Bounces, SpamComplaints, Cost, DataFeedID, TagID)         VALUES(    @ReportDate, @SiteID, @PKID, @Sent, @Delivered, @TotalOpens, @UniqueUserOpens,     @UniqueUserMessageClicks, @UniqueUserLinkClicks, @TotalLinkClicks, @Unsubscribes,     @Bounces, @SpamComplaints, @Cost, @DataFeedID, @TagID)SET NOCOUNT OFF this is the one to clear: SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER proc [dbo].[spCRMPublisherSummaryClear](     @SiteID INT,     @DataFeedID INT,     @ReportDate SMALLDATETIME) AS    DELETE LandingSiteSummary        WHERE SiteID=@SiteID AND ReportDate=@ReportDatebut it doesnt seem to be working.Please suggest. 

View 2 Replies View Related

Getting Duplicate Identity Values In SQL 6.5

Aug 26, 1998

We are experiencing a problem at more than one site - it has only
just started happening.

We are actually getting duplicate Identity column values in various
tables and the values seem random - its not like the counter just gets
wound back.

We have used dbcc checkident and also bcp out and in the data, which
of course corrected the tables but only temporarily. Our application
is not doing any select into`s - just plain old inserts which for some
reason are allowing dups to be inserted into the tables.

problem sites are either sp3 or sp4.

There are thousands of sites (including most of ours) where there are
no problems like this with this particular app.

Any help from anyone would be most appreciated.

View 1 Replies View Related

Deletion Of Duplicate Values

Jun 11, 2007

hi,

i am trying to delete rows where a particular column (hours) has the same value for the same member (primary key) but where the effective dates are different. i want to delete the duplicate(s) rows which have the most recent effective date(s).

can you help?

View 14 Replies View Related

Extracting The Duplicate Values

Sep 11, 2004

hi all

i want to extract only the duplicate values from a table
can any one know the sql syntax for that
thnking u
jag

View 2 Replies View Related

Counting Duplicate Values

Nov 12, 2004

I know this question has been asked before but this is a little different and I can't seem to get my head around it right now.
What i have is a table like so:

ID1 ID2 DESC
100 24 something1
100 24 this is a test
100 24
100 25 somethingelse
101 36 something
101 37 something else altogether

What i need is to determine which ID1 value has the same ID2 value listed more than once WITH the description filled in. If there is no description filled in even though the ID2 may be listed twice on one ID1, then it's ok and don't want it displayed in the query.

So, in this case, ID1 of 100 has ID2 24 listed twice with a description on both ID2's (of 24). this is what I need to show up in the query like so:

ID1 ID2 DESC
100 24 something1
100 24 this is a test

Could someone give me a hand with this? I've found similiar problems...but haven't been able to apply those answers to this.

Thx

View 7 Replies View Related

SQL FIND DUPLICATE VALUES

May 28, 2008

I have written this script: What I want to do now is, with the new JOINED table find and display all the duplicates custID WHERE the price is either 100 OR 200. Can anyone help? I am very new to all this and can't see how to do it. Thanks!


SELECT
*
FROM
table_customer T1
INNER JOIN
table_itemsBought T2
ON
T2.custID = T1.custID
WHERE
price = '100'
OR price = '200';

View 2 Replies View Related

Duplicate Reference Key Values

Mar 29, 2007

HI, I keep getting this warning with a lookup (full cache mode) that retreives data form a table that contains the following information:

SRCE_SYS TABLE_NAME FIELD_NAME CODE ENGLISH_DESCRIPTION
STATIC STATIC PM_PC_TX_TYPE_CODE G GROSS
STATIC STATIC PM_PC_TX_TYPE_CODE E EXCESS
STATIC STATIC PM_PC_TX_TYPE_CODE F FACULTATIVE
STATIC STATIC PM_PC_TX_TYPE_CODE S SURPLUS
STATIC STATIC PM_PC_TX_RIDER_CODE BOAT BOAT
STATIC STATIC PM_PC_TX_RIDER_CODE RIDER RIDER
STATIC STATIC PM_PC_TX_RIDER_CODE CONT CONTENTS



The column tab matches SRCR_SYS, TABLE_NAME and FIELD_NAME (using constants defined in a derived column transform) .The code column comes from the source. We want to retreive the english_description colum from SRCR_SYS, TABLE_NAME,FIELD_NAME and CODE in the dataflow.



I would normally ignore the warning but sometimes, it seems that the lookup does not match any values and enabling memory restriction on the advanced tab resolve the issue and suppress the warning.



As I said, I keep getting this warning and I don't know why since there are no duplicates in the table? Am I missing something?



Thank you,

Christian

View 3 Replies View Related

Setting Default Values

Jun 6, 2006

Pardon the newbie question...but I'm trying to load a dimension table in a small data mart that has columns in it that are unique to the dimension and not sourced from any source table. Two of those columns are date columns that I want to default to the system date and the other column I want to load with a default value. I can't figure out how to do this within a data flow task. The source columns flow from the input db source into a scd transform but I can't seem to edit the columns in the target table table if they don't actually come from a data source. There doesn't seem to be a data transform object to handle this.

Thanks.

View 5 Replies View Related

Find Duplicate In Column Tied To Another Column

Apr 29, 2015

I have one table with two columns, GUID and PID and another table with three columns, GUID, LastName, and FirstName. For each unique PID, I need to find the PID's that have more than one GUID and then match that with their respective FirstName and LastName from the other table.

Table1

GUID PID
GUID1 PID1
GUID1 PID1
GUID1 PID1
GUID2 PID1
GUID3 PID2
GUID3 PID2
GUID3 PID2

Table2

GUID LastName FirstName
GUID1 Mulder Fox
GUID2 Scully Dana
GUID3 Skinner Walter

So I'm looking for a result like:

PID1 GUID 1 Mulder Fox
----- GUID 2 Scully Dana

View 5 Replies View Related

Checking Duplicate Values Two Tables

Feb 5, 2005

Hi All,

Is it possible in SQL to Restrict value in one table checking a value on anather tables.

Scenerio-1.

I have two table let say,
Teb1 and Teb2. Teb1 has a column called- Business_type and Teb2 has a coulmn called Incorporated_date. I just need to restrict If the value of Business_type column in Teb1 is "Propritory" then Incorporated_date in Teb2 should not be blank (nulll) . Otherwise it can take null value.

Scenerio -2.[/B]

I have table called [B]SIC.

This table has a two column called SIC1 anc SIC2 . Is it possible to restrict that clumn SIC1 and SIC2 should have same values( duplicate values cannot be entered in both columns.

Please Advise.
Vijay

View 1 Replies View Related

Page 2 - Deletion Of Duplicate Values

Jun 11, 2007

Quote: Originally Posted by achoudry ps i am using sqlserver well, whaddya know, eh

do you realize you posted in the mysql forum?

i'm gonna move this thread to the sql server forum

View 12 Replies View Related

Find Duplicate Values And Get Timediff

Dec 10, 2013

Is there a way to find duplicate values and get the timediff from the start and end of each duplicate.

datetimeTagname value MachineValueTime Diff Minutes
12/9/13 8:55machine_1 14,423 Machine_1 14,423 5
12/9/13 9:00machine_1 14,423 Machine_1 14,428 9
12/9/13 9:05machine_1 14,428 Machine_1 42,743 4
12/9/13 9:10machine_1 14,428
12/9/13 9:14machine_1 14,428
12/9/13 11:32machine_1 42,743
12/9/13 11:36machine_1 42,743

View 6 Replies View Related

Get Rows With Duplicate Values In Certain Columns

Jul 23, 2005

Hi there,I would like to know how to get rows with duplicate values in certaincolumns. Let's say I have a table called "Songs" with the followingcolumns:artistalbumtitlegenretrackNow I would like to show the duplicate songs to the user. I considersongs that have the same artist and the same title to be the same song.Note: All columns do not have to be the same.How would I accomplish that with SQL in SQL Server?Thanks to everyone reading this. I hope somebody has an answer. I'vealready searched the whole newsgroups, but couldn't find the solution.

View 2 Replies View Related

Stopping Duplicate Values From A Junction Table

Feb 28, 2008

Hi i have a junction table(UserGroups) which is linking my "users" table with my "groups" table, however when the information is coming back in the format below, instead i want the group names to appear in only one field, instead of repeating the same data, could someone please tell me what i need to change.




UserName: Edwin CarolsUserAge: 28JobTitle: ManagerGroupName: MUFC

UserName: Edwin CarolsUserAge: 28JobTitle: ManagerGroupName: AFC
Below is my SQL statement; 
SELECT Users.UserName,Users.UserAge, Users.JobTitle, Groups.GroupName FROM Users INNER JOIN UserGroups ON Users.UserID = UserGroups.UserID INNER JOIN Groups ON UserGroups.GroupID = Groups.GroupID WHERE (Users.UserID = '5')

View 11 Replies View Related

Filtering/Grouping To Remove Duplicate Values...

Oct 18, 2001

There's some SQL below (T-SQL) & I'm wanting to have this result set
grouped by Venue_ID in order to remove rows where there are duplicate values contained in just one column.

The columns BCOM_ID contain unique values, but Venue_ID can have duplicate
values. I only want to get rows for one instance of the Venue_ID (per
BCOM_ID) - doesn't matter which instance but basically, no duplicates.

Oh yes, one of the columns is a Bit column.

Any ideas would be welcome & appreciated!

Many thanks,
Darren
darren@darrenbrook.fsnet.co.uk

SQL:-

SELECT Booking_Header.BH_ID,
Booking_Header.Booking_Header_Description,
Booking_Header.BStat_ID, Booking_Header.BT_ID,
Booking_Header.Tagged, Booking_Header.Status_Timestamp,
Booking_Header.Start_Date, Booking_Header.Days_Qty,
Proposal.PPL_ID, Proposal.PPL_Status,
Booking_Component.BCOM_ID,
Booking_Component.Component_Description,
Booking_Component.Venue_ID, Venue.Venue_Code,
Venue.Description, Address.Address_ID, Address.Town,
Booking_Status.BStat_Description,
Booking_Type.Type_Description
FROM dbo.Booking_Header INNER JOIN
dbo.Proposal ON
dbo.Booking_Header.BH_ID = dbo.Proposal.BH_ID INNER JOIN
dbo.Booking_Component ON
dbo.Proposal.PPL_ID = dbo.Booking_Component.PPL_ID INNER
JOIN
dbo.Venue ON
dbo.Booking_Component.Venue_ID = dbo.Venue.VE_ID INNER JOIN
dbo.Address ON
dbo.Venue.VE_ID = dbo.Address.VE_ID INNER JOIN
dbo.Booking_Status ON
dbo.Booking_Header.BStat_ID = dbo.Booking_Status.BStat_ID INNER
JOIN
dbo.Booking_Type ON
dbo.Booking_Header.BT_ID = dbo.Booking_Type.BT_ID
WHERE (dbo.Proposal.PPL_Status = 1) AND
(dbo.Booking_Header.BH_ID = 10)



Thanks,
Darren

View 2 Replies View Related

Stopping Duplicate Values From A Junction Table

Mar 1, 2008

Hi i have a junction table(UserGroups) which is linking my "users" table with my "groups" table, however when the information is coming back in the format below, instead i want the group names to appear in only one field, instead of repeating the same data, could someone please tell me what i need to change.

UserName: Edwin Carols
UserAge: 28
JobTitle: Manager
GroupName: MUFC


UserName: Edwin Carols
UserAge: 28
JobTitle: Manager
GroupName: AFC


Below is my SQL statement;


Code:

SELECT Users.UserName,Users.UserAge, Users.JobTitle, Groups.GroupName FROM Users INNER JOIN UserGroups ON Users.UserID = UserGroups.UserID INNER JOIN Groups ON UserGroups.GroupID = Groups.GroupID WHERE (Users.UserID = '5')



And my table structure is like;

Users; UserID, UserName, UserAge
Groups; GroupID, GroupName
UserGroups; UserGroupID, UserID, GroupID

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved