Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Coding for not displaying duplicates on UI

Author  Topic 

wshtrue
Yak Posting Veteran

74 Posts

Posted - 2005-07-16 : 11:14:17
Column1 Column2 Column3 Column4 Column5
12345 7/13/05 06:42:53 9999 1 9876543


Column1 Column2 Column3 Column4 Column5
12345 7/13/05 06:42:53 9999 Active 9876543
12345 7/13/05 06:42:53 9999 Active 9876542
12345 7/12/05 06:40:53 9999 Active 9876544
12345 7/11/05 06:41:53 9999 Active 9876545

Hello Guys,
First 2 tables are database tables. My UI is displaying information based on these two tables. First table is keeping only one record that is the latest one and second table is keeping the history. Table2.Column4 is showing me the description of table1. Column4. Column5 is unique Column 3 is common in both the tables so what ‘s happening is my UI is displaying me like this
UI1
Column1 Column2 Column3 Column4 Column5
12345 7/13/05 06:42:53 9999 Active 9876543
12345 7/13/05 06:42:53 9999 Active 9876543
12345 7/12/05 06:40:53 9999 Active 9876544
12345 7/11/05 06:41:53 9999 Active 9876545

According to my database Guy he is saying that UI will display the latest record from table 1 and the whole history from table 2 so I guess according to that logic it should show me like this:
UI2
Column1 Column2 Column3 Column4 Column5
12345 7/13/05 06:42:53 9999 Active 9876543
12345 7/13/05 06:42:53 9999 Active 9876543
12345 7/13/05 06:42:53 9999 Active 9876543
12345 7/12/05 06:40:53 9999 Active 9876544
12345 7/11/05 06:41:53 9999 Active 9876545
Please correct me if I am wrong
Can you please tell me what should be the coding if UI1 is showing me like this and what should be the coding if UI2 should show me like this?
And Final Question is How should be the coding if I don’t want them to show duplicates. I am talking about column2. I want that if Column 2 is the same then this record should be shown once only. Column 2 and Column4 of table 2 are displaying on UI other fields I just showed you which are common in both tables.
Your help will be greatly appreciated. Thanks

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-07-17 : 21:36:22
hi wshtrue

I found it a little hard to understand what you are asking, but it sounds like you want to show only one record for each date? In that case, which one do you want to show? the most recent one? (by time) or the one with the largest value for Column5 or what?

Or if you just want to show only the current record - why include the history table at all?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -