Revision 2200
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
445 | 445 |
cond_ += ' %s' |
446 | 446 |
return cond_ |
447 | 447 |
|
448 |
query = 'SELECT ' |
|
448 |
query = 'SELECT' |
|
449 |
|
|
450 |
# DISTINCT ON columns |
|
451 |
if distinct_on != None: |
|
452 |
query += ' DISTINCT' |
|
453 |
if distinct_on != distinct_on_all: |
|
454 |
query += ' ON ('+(', '.join(map(parse_col, distinct_on)))+')' |
|
455 |
|
|
456 |
# Columns |
|
457 |
query += ' ' |
|
449 | 458 |
if fields == None: query += '*' |
450 | 459 |
else: query += ', '.join(map(parse_col, fields)) |
460 |
|
|
461 |
# Main table |
|
451 | 462 |
query += ' FROM '+table0 |
452 | 463 |
|
453 | 464 |
# Add joins |
Also available in: Unified diff
sql.py: mk_select(): Implemented DISTINCT ON according to the distinct_on param