Gossamer Forum
Home : Products : Gossamer Links : Discussions :

lsql_CatLinks are more than lsql_Links

Quote Reply
lsql_CatLinks are more than lsql_Links
Hi,

I checked my linkssql tables.

lsql_CatLinks - 33454
lsql_Links - 33448

Why is that difference? I backed up yesterday from BACKUP.1 file.

I run resync database, repair tables, build search index. No use.

No errors while importing from backup yesterday.

I checked the forums. Alex in one post said this code:
-----------------------------------------
my $sth = $DB->table('CatLinks', 'Links')->select('left_join', ['LinkID'], { ID => undef });
my @ids = $sth->fetchall_list;
# $DB->table('CatLinks')->delete( { LinkID => \@ids } );
-----------------------------------------

Where to run this exactly? I tried in 'SQL Monitor' screen. I am getting this message:

---------------------------------------------
Error: Query Error: Failed to execute query: 'my $sth = $DB->table('CatLinks', 'Links')->select('left_join', ['LinkID'], { ID => undef }); my @ids = $sth->fetchall_list; # $DB->table('CatLinks')->delete( { LinkID => \@ids } );' Reason: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'my $sth = $DB->table('CatLinks', 'Links')->select('left_join',
----------------------------------------------------------------

Any help?
Quote Reply
Re: [hegu] lsql_CatLinks are more than lsql_Links In reply to
Do you have any links in multiple categories? This would give you more records in CatLinks than in Links.
Quote Reply
Re: [afinlr] lsql_CatLinks are more than lsql_Links In reply to
Thank you affinlr,

I guess so. But how to point out them? When i clicked on 'Check duplicates' , i get some 566 links. All these are with same url because one person submitted three links on the same url page.

So can you tell me how to pick those 6 links?
Quote Reply
Re: [hegu] lsql_CatLinks are more than lsql_Links In reply to
Try this:

SELECT COUNT(*) AS repetitions, LinkID FROM CatLinks GROUP BY LinkID HAVING repetitions > 1;
Quote Reply
Re: [afinlr] lsql_CatLinks are more than lsql_Links In reply to
Hi,

Yes. Your code brought 6 links. But all have different urls and different titles and different categories.
How come they are not same?
Quote Reply
Re: [hegu] lsql_CatLinks are more than lsql_Links In reply to
These should be the links that are in the CatLinks table more than once. If you do

SELECT * FROM CatLinks WHERE LinkID = '1'

and replace 1 with the LinkID of one of the six links returned by the statement in the post above it should show you the duplicate entries in the table for that link.
Quote Reply
Re: [afinlr] lsql_CatLinks are more than lsql_Links In reply to
Thank you!
it worked.
Only thing is i have to change the 'CatLinks' in the code to 'lsql_CatLinks', as my tables are named after lsql.