Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate Values in same SQL Table 1

Status
Not open for further replies.

tmoor

Programmer
Aug 29, 2002
16
US
Hi all:
I want my Crystal Report to print only those records where the values (ActionUI and HearingUI) in the same table are the same. How can I accomplish this? My MSSQL relationships are fairly complex. I'm trying to print records that have been changed and if they have been changed, another record will have been added with the same ActionUI and HearingUI.
Using SQL2000 and Crystal 8.5 professional.
Thanks
Terry
 
Here's one option:

Add the same table a second time (you would need to give an alias) and join the table to its "clone" using these two columns.

Then, add a condition stating that the primary key from the original table in NOT equal to the primary key in the clone.

hth,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Hi Ido:
Brilliant..your solution works perfectly. Just a curious question if you have time, how does the SQL engine work in this scenario? Does it sit on the first record, store the data, loop through the alias table storing matching criteria, then fetch the second record and go through the alias table again, etc.?
Thanks again
Terry
 
The DBMS engine is probably treating the single table as if it were two separate physical tables being joined.

Cheers,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top