codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  perl script help needed  abhilash at 19:04 on Friday, October 26, 2007
 

hi all...
i need to write a perl program which does the following:

it connects to the database and retrieves the rows from a table, which i am able to do.

For example, the table looks like this :
Name PID CID LID
a1 0 0 10
a1 0 0 20
a1 0 1 30
a2 0 2 40
a2 1 1 50
a3 0 1 10


so, here i need to check for duplicates and the rule is as folows:

eliminate duplicate rows which has the same CID, same PID and same name.
SO in the above example, i need to eliminate either row 1 or row 2. LID is NOT an issue here, i mean it does not matter if they are same or different.

I am storing all columns in separate arrays and then trying to sort based on columns. I just have an idea but I would like to have the perfect working code.

I will be grateful if some1 could provide me with one.
Thankyou.
Regards,
Abhilash

  Re: perl script help needed  HumanoidTyphoon at 10:18 on Friday, November 02, 2007
 

Hmmm not sure how you would do that efficiently =P

Perhaps look at "DistinctRow" sql statement.

fetch all the distinct combinations for those 3 columns and run through them. find out how many occurences there are for each distinct result. If there is more than 1 match, delete all but one.

  Re: perl script help needed  sanju_gates at 11:54 on Friday, November 02, 2007
 

just try to set LID and name as primary key before inserting values in database so it ll not allow duplication.

otherwise selct DISTINCT name,lid,cid from Tablename in sql query.

  Re: perl script help needed  abhilash at 13:50 on Friday, November 02, 2007
 

thank u for the reply.
I am not the DB admin and so i am not able to do so.
Anyways i fixed it.
You ppl are pretty late in replying.
Thank you .
Abhi








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  strange Perl problem with printf vs. sprintf
•  Re: perl script help needed
•  help me in setting background image in perl
•  Re: help me
•  Net::ftp->login problem
•  Timer
•  Double execution problem in .Net
•  saving??
•  Reading an ASCII file


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007