View Single Post
Old 10-25-2017, 12:14 PM   #237
DaltonST
Deviser
DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.
 
DaltonST's Avatar
 
Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
Quote:
Originally Posted by Tanjamuse View Post
I tried to use that column in a SQL query, but didn't get any results:

Code:
SELECT book  FROM books_custom_column_37_link
 WHERE value IN
 ( SELECT value 
 FROM books_custom_column_37_link
 GROUP BY value 
 HAVING COUNT(*) > 1 )
Tanjamuse:

[1] Composite Custom Columns do not have a book...link table, so your books_custom_column_37_link is wrong. It should be custom_column_37 per the ToolTips that you have if you hover your mouse over the right side of the SQL Query Tab.

[2] Unfortunately, #1 would not work even if it were correct, because Calibre does not update a Composite Custom Column in the SQLite metadata.db database; it only updates the GUI cache. Composite Custom Columns tables are always empty unless you use the Calibre Companion special "Library-Closed" plug-in, that does not work for you here, because your Library is open, not closed.

[3] You need to create a "real" Comments Custom Column and use Search & Replace to copy the Composite CC to the new "real" CC. The S&R function first uses the GUI cache, not the SQLite database, but then does update the SQLite database at the end.

[4] Change your SQL Query to search the "real" Comments CC instead of the "virtual" Composite CC.

Please study the attached image which is a comprehensive example of the above.

Note that my MCS test Library's Custom Columns and their numbers are different than yours. You must use your ToolTips, not mine that are shown in the example.



DaltonST
Attached Thumbnails
Click image for larger version

Name:	mcs_sqlquery_tooltips_composite.jpg
Views:	338
Size:	784.8 KB
ID:	159640  
DaltonST is offline   Reply With Quote