Zotero's a great tool for managing your citation library, but sometimes you need that data elsewhere, and though Zotero has some good export features, you may sometimes want something like a simple spreadsheet of citations to work with.Zotero runs on a SQLite database, which makes report generation and, thereby, conversion to a different format difficult for the lay user. To export Zotero, we will open the SQLite database, submit a query, and then copy the results to Excel, Calc, or another spreadsheet program.Let's get started!
/* Begin query. */
/* Basic SELECT statement. */
SELECT
/*Identify which fields to SELECT for your output. The left identifier represents the database abbreviated name (set below in the FROM and JOIN statements) and the database field name we want, while the right identifier (after the AS statement) represents the column header as it will appear in your output. */
i.itemID AS ITEMID,
title.value AS TITLE,
t.typeName AS TYPE,
d.value AS DATE,
issn.value AS ISSN,
isbn.value AS ISBN,
doi.value AS DOI,
url.value AS URL,
pub.value AS PUB,
issue.value AS ISSUE,
volume.value AS VOLUME,
series.value AS SERIES,
pages.value AS PAGES,
proceedingsTitle.value AS PROCEEDINGS,
bookTitle.value AS BOOK,
abstract.value AS ABSTRACT,
c1.firstName AS AUTHOR_1_FIRST,
c1.lastName AS AUTHOR_1_LAST,
c1.shortName AS AUTHOR_1_SHORT,
ct1.creatorType AS AUTHOR_1_TYPE,
c2.firstName AS AUTHOR_2_FIRST,
c2.lastName AS AUTHOR_2_LAST,
c2.shortName AS AUTHOR_2_SHORT,
ct2.creatorType AS AUTHOR_2_TYPE,
c3.firstName AS AUTHOR_3_FIRST,
c3.lastName AS AUTHOR_3_LAST,
c3.shortName AS AUTHOR_3_SHORT,
ct3.creatorType AS AUTHOR_3_TYPE,
c4.firstName AS AUTHOR_4_FIRST,
c4.lastName AS AUTHOR_4_LAST,
c4.shortName AS AUTHOR_4_SHORT,
ct4.creatorType AS AUTHOR_4_TYPE,
c5.firstName AS AUTHOR_5_FIRST,
c5.lastName AS AUTHOR_5_LAST,
c5.shortName AS AUTHOR_5_SHORT,
ct5.creatorType AS AUTHOR_5_TYPE,
t1.name AS TAG_1,
t2.name AS TAG_2,
t3.name AS TAG_3,
t4.name AS TAG_4,
i.dateAdded AS DATE_ADDED,
i.dateModified AS DATE_MODIFIED,
i.key AS ZOTERO_KEY,
extra.value AS EXTRA
/* The general FROM statement merely queries the `items` table. This table does not have much information in it, so all the information we want will be added with JOIN commands below. */
FROM
items i
/* Begin JOIN commands. First JOIN command.
Join command. Depending upon the information (whether there is one value or many and whether the value is essential to returning a row), we may use either INNER JOIN or LEFT JOIN. */
INNER JOIN
/* The database table name (on the left) and the abbreviated table name (on the right), which we reference in our SELECT query above. */
itemDataValues title
/* Identifies the conditions that direct what data is attached to the `items` table based upon the JOIN command. */
ON
title.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'title' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
/* Additional JOIN statements. Each of these statements is necessary to attach a new table of information to our initial `items` table. */
LEFT JOIN
itemTypes t
ON
t.itemTypeID = i.itemTypeID
LEFT JOIN
itemDataValues issn
ON
issn.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'ISSN' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues doi
ON
doi.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'DOI' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues isbn
ON
isbn.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'ISBN' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues url
ON
url.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'url' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues pub
ON
pub.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'publicationTitle' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues d
ON
d.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'date' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues abstract
ON
abstract.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'abstractNote' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues pages
ON
pages.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'pages' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues issue
ON
issue.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'issue' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues series
ON
series.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'series' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues volume
ON
volume.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'volume' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues proceedingsTitle
ON
proceedingsTitle.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'proceedingsTitle' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
itemDataValues bookTitle
ON
bookTitle.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'bookTitle' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
LEFT JOIN
creatorData c1
ON
c1.creatorDataID = (SELECT creatorDataID FROM creators WHERE creatorID = (SELECT creatorID FROM itemCreators WHERE itemID = i.itemID LIMIT 0,1) LIMIT 1)
LEFT JOIN
creatorTypes ct1
ON
ct1.creatorTypeID = (SELECT creatorTypeID FROM itemCreators WHERE itemID = i.itemID LIMIT 0,1)
LEFT JOIN
creatorData c2
ON
c2.creatorDataID = (SELECT creatorDataID FROM creators WHERE creatorID = (SELECT creatorID FROM itemCreators WHERE itemID = i.itemID LIMIT 1,1) LIMIT 1)
LEFT JOIN
creatorTypes ct2
ON
ct2.creatorTypeID = (SELECT creatorTypeID FROM itemCreators WHERE itemID = i.itemID LIMIT 1,1)
LEFT JOIN
creatorData c3
ON
c3.creatorDataID = (SELECT creatorDataID FROM creators WHERE creatorID = (SELECT creatorID FROM itemCreators WHERE itemID = i.itemID LIMIT 2,1) LIMIT 1)
LEFT JOIN
creatorTypes ct3
ON
ct3.creatorTypeID = (SELECT creatorTypeID FROM itemCreators WHERE itemID = i.itemID LIMIT 2,1)
LEFT JOIN
creatorData c4
ON
c4.creatorDataID = (SELECT creatorDataID FROM creators WHERE creatorID = (SELECT creatorID FROM itemCreators WHERE itemID = i.itemID LIMIT 3,1) LIMIT 1)
LEFT JOIN
creatorTypes ct4
ON
ct4.creatorTypeID = (SELECT creatorTypeID FROM itemCreators WHERE itemID = i.itemID LIMIT 3,1)
LEFT JOIN
creatorData c5
ON
c5.creatorDataID = (SELECT creatorDataID FROM creators WHERE creatorID = (SELECT creatorID FROM itemCreators WHERE itemID = i.itemID LIMIT 4,1) LIMIT 1)
LEFT JOIN
creatorTypes ct5
ON
ct5.creatorTypeID = (SELECT creatorTypeID FROM itemCreators WHERE itemID = i.itemID LIMIT 4,1)
LEFT JOIN
tags t1
ON
t1.tagID = (SELECT tagID FROM itemTags WHERE itemID = i.itemID LIMIT 1)
LEFT JOIN
tags t2
ON
t2.tagID = (SELECT tagID FROM itemTags WHERE itemID = i.itemID LIMIT 1,1)
LEFT JOIN
tags t3
ON
t3.tagID = (SELECT tagID FROM itemTags WHERE itemID = i.itemID LIMIT 2,1)
LEFT JOIN
tags t4
ON
t4.tagID = (SELECT tagID FROM itemTags WHERE itemID = i.itemID LIMIT 3,1)
LEFT JOIN
deletedItems
ON i.itemID = deletedItems.itemID
LEFT JOIN
itemDataValues extra
ON
extra.valueID = (SELECT itemData.valueID FROM itemData WHERE itemData.fieldID = (SELECT fieldID FROM fields WHERE fields.fieldName = 'extra' LIMIT 1) AND itemData.itemID=i.itemID LIMIT 1)
/* End JOIN statements. */
/* Optional JOIN Statements. */
/* This is an optional JOIN statement to select for a specific collection. To only show a specific collection in your output, remove the double-hyphen from the beginning of the statement and replace the collectionName value (e.g. "Instructional Design") with the name of your desired collection (encased by quotes). */
--INNER JOIN collectionItems ON collectionItems.itemID = i.itemID AND collectionItems.collectionID = (SELECT collectionID FROM collections WHERE collectionName = "Instructional Design" LIMIT 0,1)
/* End optional JOIN statements. */
/* Final conditional WHERE statement allows us to ignore entries that have been deleted in Zotero. */
WHERE deletedItems.itemID IS NULL
/* If you would like to add any additional selection criteria, this is the place to do it. Here are some examples that you may wish to use. Merely remove the double-hyphen from the beginning of a condition to make it active in the query. */
/* Begin optional conditions. */
/* Only show journal articles. */
--AND t.typeName = "journalArticle"
/* Only show items where the first author's last name is Smith. */
--AND c1.lastName = "Smith"
/* Only show items from a particular publication. */
--AND pub.value = "Teachers College Record"
/* Only show items added to Zotero after January 1, 2010. */
--AND i.dateAdded > "2010-01-01"
/* End optional conditions. */
/* End query. */
Let me know if this was helpful for you!
Comments
Anonymous (not verified)
Sat, 04/03/2010 - 22:32
Permalink
Great! How about exporting tags as well?
This works great -- thanks for posting it! Wondering if you could add the code needed to add each source's tags and what kind of file it is (journal article, etc.) to this query?
Thanks!
Graham
Royce Kimmons
Tue, 04/06/2010 - 14:12
Permalink
Updated
Thanks. Just updated the code to be shorter and to give the source type as well (journal article, etc.), but tags are tricky business. The only way that I can think of to get them out is via an external scripting tool like PHP. Will try to hone my SQL ninja skills some more, but at this point, I don't think it can be done with a single SQL query.
Anonymous (not verified)
Tue, 06/01/2010 - 00:03
Permalink
Hi Royce. This looks like
Hi Royce.
This looks like great work. I like Zotero:
1. as a place to store my references
2. the easy was it provides to "farm" references from libraries, the web etc.
3. its ready ability to export bibliographies.
But it is a little buggy at times. Plus I need to be able to access the data it stores in more general ways than are in the standard interface. The Word add-in is great, but you can't manipulate data very easily in Word. I use Excel (with regexp extension) as my Swiss army knife for day-to-day low-level data manipulation. I will use the work you have posted as a template for SQL-level access to the Zotero data store from Excel. When I've done that, I will get back to you.
I note that the Zotero people seem in general to prefer to maintain a Zotero-specific API rather than encourage SQL-level manipulation. You get round that problem by copying the Zotero database, but that may not be flexible or dynamic enough for me. Plus I'm still at a very low level in JavaScript. I need to improve in the near future, but must "complete" my literature review first.
I'm also a Ph.D student, albeit a much older one than you are. I'd like to tell you (and the rest of the world) more, and to do that I need to set up my own website. I long ago concluded that a Drupal-based CMS approach would be right for me there, and I notice that your site is Drupal driven. Have you documented your use of Drupal, and if so, where? Do you host your own Drupal site, or have you found a good hoster for Drupal?
My research, incidentally, is not a million miles from yours - I'm looking at the question:
"How do knowledge workers manage their personal information and knowledge and how can they be helped to improve their personal knowledge management (PKM)?"
Mark, Rennes, France.
Royce Kimmons
Tue, 06/01/2010 - 08:54
Permalink
Drupal, Zotero, etc.
Hi Mark,
Thanks for the thoughtful reply! Zotero is one of those tools that I've quickly come to love for how much easier it has made my life as a doc student. As far as the API goes, I haven't looked into it much, because I haven't needed much dynamic access to the database but have, rather, used Zotero in some capacities as a data-gathering tool and have merely needed a one-way feed from it (for which, querying the database seemed to be the simplest answer). Interestingly enough, the reason that I wrote this query to begin with was so that I could take citations into a csv file in order to import them as Drupal nodes (using the Biblio module). I've done this on two sites thus far (though both may not be active yet): http://mobilelearningportal.org and http://alienrescue.edb.utexas.edu/AlienRescueNetwork
If I'm a fan of Zotero, though, I'm a borderline psychofant for Drupal. This site is the eighth or ninth site I've developed with it, and I use it for both research and work. I haven't documented much of what I've done with it, because the community documentation tends to be so good already that I rarely have a question that I can't find a quick answer to with a simple search. As far as hosts go, I've used Hostmonster in the past and liked it. I'm currently using JustHost (because it was much cheaper with their introductory offer) but may switch back at some point. I also run some Drupal development sites on my own server (like http://rkimmons.no-ip.org/dev/drupal ), so I've tried a few methods. I'd probably recommend going the host route, though, if you're just getting started with it, because most even have one-click installations which prevents you from having to configure a LAMP environment and allows you to focus more on your content.
I currently use Drupal 6 on all of my sites, and some of the contributed modules that I cannot live without include: CCK (including FileField), Views, Cobalt, Biblio, and WYWSIWYG (with TinyMCE).
If you have concrete questions about using Drupal or how to solve a particular problem with it, I'd be happy to help, but it's such a robust and flexible tool that it's difficult to say much of anything useful without a context for what you want it to solve for you.
Royce
Anonymous (not verified)
Fri, 06/04/2010 - 23:33
Permalink
Hi again Royce. Thank you for
Hi again Royce.
Thank you for your very helpful reply.
I have two reasons for wanting to use Drupal.
Firstly: Not only am I a (part-time)Ph.D. student, but I am also a teacher. As a school, we currently use Google Apps to give us some community website features, but Google Apps was never intended to be the learning management which we are trying to make it into.
Secondly: as part of my research, in which the principal methodology is action research, I need to be able to work with my research subjects and collaborators.
My ideal template for a good Drupal site is the one used by developer Pierre at NeoTech Systems. I am also a great fan of his information management system InfoQube (which used to be called SQLNotes). See http://www.sqlnotes.net/drupal5/
Thank you very much for your offer. I need to specify more clearly what I want from my site before I get too heavily into the Drupal aspects, so that will be in the summer rather than in the spring.
Royce Kimmons
Sat, 06/05/2010 - 00:14
Permalink
Drupal as an LMS
Cool site.
Initially, as a practitioner, I was really interested in Drupal as an LMS, too, and was a bit distraught that there weren't more school-oriented modules out there. And, though I don't think Drupal would be harmed by anyone creating LMS-like features for it, I've come to realize that perhaps the true value of Drupal lies in its anti-LMS-ness.
Maybe. Well, at least, suffice it to say that now I'm much more interested in using it to support Personal Learning Environments and Personal Learning Networks than as an LMS, and I think that it's much more suited to that anyway.
Anyhow, good Drupaling in the summer!
Anonymous (not verified)
Wed, 04/14/2010 - 18:01
Permalink
No results for my query...
Hello, can you think of any reason why this query would return no results? I tried a much simpler query to make sure the problem wasn't with my zotero.sqlite file (SELECT * FROM items) and that worked fine... I'm wondering if something in the table joins is keeping it from returning the expected results.
--Billy S.
Anonymous (not verified)
Wed, 04/14/2010 - 18:16
Permalink
Update
I changed the 6th line up from the bottom, from "INNER JOIN collections" to "LEFT JOIN collections" and got results.
Anonymous (not verified)
Wed, 04/14/2010 - 18:34
Permalink
Last one, I promise!
I edited the query so the column headers would be a bit more descriptive (see below). Thanks for putting the work into this! I'm going to use it all the time now!
--Billy S.
Query removed and incorporated into main query.Royce Kimmons
Thu, 04/15/2010 - 11:38
Permalink
Great Addition!
Great additions, Bill! I've updated the script in the post to reflect your changes with one exception. When you ran the initial script and got a null result, did you change the collection name from "Instructional Design" to a collection that you had created in Zotero (I realize now that I wasn't explicit about this initially, but have updated since)? If not, then it was returning only the results for collections named "Instructional Design," which you probably didn't have. Doing a LEFT JOIN instead of an INNER JOIN basically disregards the filter, so if you want all the results, not just from a single collection, then your LEFT JOIN approach works great.
Anonymous (not verified)
Wed, 04/20/2011 - 09:01
Permalink
Categories
Hello!
Thanks for these instruction - it worked with me, but i have the problem that i get no information like author, booktitle in the table after "run sql". there is only type and sometimes some numbers in the other cells.
csv:
"8",,,,,,,,,,,,"book",,,,,,
"10","0006-291X",,,,,,,,,,,"journalArticle","0006-291X","0006-291X","0006-291X","0006-291X","0006-291X","0006-291X"
how do i get the book title, authors names, year in the output?
Thanks!
Royce Kimmons
Thu, 04/21/2011 - 11:28
Permalink
I updated the script today,
I updated the script today, and it should fix this problem. So, try the new, updated script and let me know if it solves your issue.
Anonymous (not verified)
Mon, 06/14/2010 - 19:58
Permalink
Adding other fields, esp. abstract
Thank you for this code! I'm working on a research project about data citation practices and this code is most helpful for managing some of the basic data extraction I am doing from articles. I'm admittedly naive when it comes to SQL, so I'm wondering how I might go about adding additional fields to this query. In particular, I would like to extract the abstract, journal volume/issue, and pages from zotero. Could you help me out with the SQL code for these fields or let me know where to find the "official" sql names of the fields in zotero so i can mimic your code for those fields. Sorry that's so basic...I'm a biologist with GUI programming experience, but not much practical SQL knowledge. Thanks!
Royce Kimmons
Tue, 07/12/2011 - 17:01
Permalink
Fields Added
The following fields have been added to the script, per your request: issue, volume, abstract, series, pages.
Anonymous (not verified)
Mon, 06/21/2010 - 18:33
Permalink
SQL error
I'm getting an error message that says the "likely error is" then lists the whole script. I've changed the collection name to a collection I actually have, and tried changing INNER to LEFT JOIN, with no success.
Any suggestions?
Sorry, I don't know much about SQL queries, but I could really use this solution - thanks for working on it!
Miles
miles.kimball@gmail.com
Anonymous (not verified)
Mon, 10/11/2010 - 17:37
Permalink
generating numbers
thank you so much for this. i tried following it but am only generating numbers. the following is a C&P of one of the lines:
"14","0003-066X",,,,,,,,,,,"journalArticle","0003-066X","0003-066X","0003-066X","0003-066X","0003-066X","0003-066X"
any idea what i may be doing wrong? your directions are clear so i'm not sure what i've done wrong.
Royce Kimmons
Wed, 10/13/2010 - 16:16
Permalink
Not Sure
I'm not sure. Is it just returning the one line or are there more entries?
Anonymous (not verified)
Sat, 10/16/2010 - 19:32
Permalink
The same problem
In all fields except authors I have issn number of the articles as SQLrun result. There is nothing in authors fields. SQLrun is returning several lines, I started to use zotero yesterday, so I have a couple of articles only.
Royce Kimmons
Fri, 11/12/2010 - 14:44
Permalink
Potential fix?
Darren seems to have fixed this issue; see his reply above.
Anonymous (not verified)
Fri, 11/12/2010 - 13:11
Permalink
FYI
I had to qualify the NATURAL LEFT JOIN with LEFT JOIN in order to get the correct output. Otherwise, the last value selected for the NATURAL LEFT JOIN value was produced for each of the selected fields which used the NATURAL LEFT JOIN.
Query removed and incorporated into main query.Thanks,
Darren
Royce Kimmons
Fri, 11/12/2010 - 14:42
Permalink
Great adjustment!
Thanks, Darren.
Anonymous (not verified)
Fri, 11/12/2010 - 13:13
Permalink
FYI
The post below will fix the problem for : generating numbers
Royce Kimmons
Thu, 04/21/2011 - 11:27
Permalink
I also did an update to the
I also did an update to the code which should fix it.
Anonymous (not verified)
Fri, 01/07/2011 - 13:27
Permalink
other fields?
Hi, I appreciate the tutorial, but I can't figure out how to add other fields to the export. Specifically, I'd like to add a list of tags to each record. Ideally, they'd be in separate columns, but I'd take them in one column for each record of necessary. Can anyone help me on that?
Royce Kimmons
Thu, 04/21/2011 - 11:27
Permalink
Extra fields need to be added
Extra fields need to be added in both the first SELECT area of the query (to tell it what to output), and they need to use a LEFT or INNER JOIN of some kind. If you tell me which field you would like to add, I may be able to help. Otherwise, the simplest way is just to change the fields.fieldName value for one of the entries.
Royce Kimmons
Thu, 04/21/2011 - 11:29
Permalink
Tags
And I did add tag functionality to the new script which will output the first four tags of any entry.
Anonymous (not verified)
Fri, 06/10/2011 - 15:30
Permalink
Google Fusion Tables
Has anyone tried to import this data to Google Fusion Tables? From there, you could generate a nice map / timeline widget. I know a lot of my research originates from a few key locations, but would be good to map this out one day!
Anonymous (not verified)
Sat, 07/09/2011 - 16:47
Permalink
Thank you so much
This has been a real help to me and I'm sure to many others.
I want to try to figure out how to use the creatorType and creatorTypeID to set out whether authors are actually authors or contributors, editors, etc and put them into relevant columns for those creator types.
Evidently it's there in the zotero.sqlite file, but it's way beyond me to sort it out. I guess it's really time consuming, though, or you'd have done it here!
Many many thanks for your work.
Andrew.
Royce Kimmons
Mon, 07/11/2011 - 20:54
Permalink
Author Types and More
Thanks for the feedback, Andrew!
I've added in the feature that you wanted to the original query. Now after every author name there will also appear a field that identifies the author type. It only required a few extra lines per author, so it wasn't a big addition.
Adding this was also good, because it helped me to find some labeling errors in the author numbering, and I took the opportunity to add some notes to help make the query's functioning more transparent and to help other users add more conditionals.
Iterations to perfection!
Royce
Anonymous (not verified)
Mon, 07/18/2011 - 02:58
Permalink
Collections
Royce, the new code works like a charm. Newbies, like me, particularly appreciate the detailed explanations incorporated in the code.
I do miss the option of restricting the query results to a particular collection though. I've tried to incorporate it in the new code, but without success. Could you please give some pointers of how one could restrict the query to a particular collection?
Many thanks for sharing the wealth.
B.
Royce Kimmons
Mon, 07/18/2011 - 20:30
Permalink
Collection Option Added
Thanks for the feedback!
I went ahead and included collection as an optional JOIN statement just before the WHERE statement. Remove the double-hyphen, change the collection name, and you should be good to go!
Royce
miskol (not verified)
Sat, 10/08/2011 - 15:37
Permalink
thanks!
hi,
thanks for this code, it sure helps a lot.
i just want to ask, is it possible to just export a certain "Collection" under "My Library"? i looked at the exported data in Excel, there isn't any data that shows where the articles have been grouped in certain "Collection". if not i would have happily do it manually from the Excel, choose only the articles that i have grouped in certain "Collection" and remove the others.
please help look into it, thanks!
Royce Kimmons
Sun, 10/16/2011 - 10:58
Permalink
To export collection
Yes, you can do this. Look near the end of the script where it says "/* This is an optional JOIN statement to select for a specific collection." There it explains how to export only a single collection.
Cheers!
jamesz7rw (not verified)
Tue, 10/18/2011 - 10:31
Permalink
article directory
I don't know if it's just me or if perhaps everybody else experiencing issues with your site. It appears as though some of the text on your posts are running off the screen. Can someone else please provide feedback and let me know if this is happening to them as well? This might be a problem with my browser because I've had this happen previously. Cheers
Royce Kimmons
Tue, 10/18/2011 - 18:57
Permalink
Hmm, haven't noticed that
Hmm, haven't noticed that before. What browser are you using? FF, Chrome, Safari, and IE 9 all work fine for me.
Marie (not verified)
Tue, 12/20/2011 - 18:31
Permalink
Tags
Thanks for that code : it has been a wonderful help for me !! Anyway, just a small thing about the tags, there's a mistake in the code and the tags sorted are the first one and the numbers 3 to 5 (so not the second one).
Below is my correction for the code to sort out the first fours :
LEFT JOIN
tags t1
ON
t1.tagID = (SELECT tagID FROM itemTags WHERE itemID = i.itemID LIMIT 1)
LEFT JOIN
tags t2
ON
t2.tagID = (SELECT tagID FROM itemTags WHERE itemID = i.itemID LIMIT 1,1)
LEFT JOIN
tags t3
ON
t3.tagID = (SELECT tagID FROM itemTags WHERE itemID = i.itemID LIMIT 2,1)
LEFT JOIN
tags t4
ON
t4.tagID = (SELECT tagID FROM itemTags WHERE itemID = i.itemID LIMIT 3,1)
And thanks again for your work !
Royce Kimmons
Tue, 01/24/2012 - 20:19
Permalink
Thanks!
Thanks Marie, you're right. I'll update the script!
Add new comment