Selecting a subset of results: equivalent to MySQL's LIMIT?
Posted: Sun Nov 01, 2015 7:36 am
Hello,
I'm trying to download the titles of all Samsung patents via PATSTAT Online. The following query works well to find them:
This gives me 255 335 rows, so I'm hitting the download limit which is at 100 000 patents max.
In MySQL I would simply add something like LIMIT 0,99999 and then LIMIT 100000,199999 etc to multiple versions of the same query but this syntax doesn't exist in MS SQL. I also tried OFFSET ... FETCH ... but that also gives a syntax error (only seems to work with MS SQL 2012 and higher). Lastly, I tried the ROW_NUMBER() OVER (...) function as described here (http://stackoverflow.com/questions/1940 ... ere-clause) but that seems to require the use of a CTE which I don't get to work in PATSTAT.
What is the best way break up a long list of results into multiple queries?
Thanks a lot.
I'm trying to download the titles of all Samsung patents via PATSTAT Online. The following query works well to find them:
Code: Select all
SELECT DISTINCT a.appln_id FROM tls201_appln a join tls207_pers_appln on tls207_pers_appln.appln_id = a.appln_id join tls206_person on tls206_person.person_id = tls207_pers_appln.person_id join tls226_person_orig on tls226_person_orig.person_id = tls207_pers_appln.person_id join tls221_inpadoc_prs on tls221_inpadoc_prs.appln_id = a.appln_id where tls206_person.hrm_l2 LIKE 'SAMSUNG ELECTRONICS %'
In MySQL I would simply add something like LIMIT 0,99999 and then LIMIT 100000,199999 etc to multiple versions of the same query but this syntax doesn't exist in MS SQL. I also tried OFFSET ... FETCH ... but that also gives a syntax error (only seems to work with MS SQL 2012 and higher). Lastly, I tried the ROW_NUMBER() OVER (...) function as described here (http://stackoverflow.com/questions/1940 ... ere-clause) but that seems to require the use of a CTE which I don't get to work in PATSTAT.
What is the best way break up a long list of results into multiple queries?
Thanks a lot.