Results 1 to 1 of 1
  1. #1
    Join Date
    Apr 2012

    Unanswered: How to create a loop to recall variable column names in the select statement


    I'm working with an existing data set that has thousands of different field names. I just want the following 900:

    geo1, geo2, geo3,...,geo300
    tri1, tri2, tri3,...,tri300

    Since the charaters for each set of 300 are the same - Is there a way to create a loop that allows me to select just the above columns from the db (without having to actually type 900 column names into my statement)? Also, can I do this using the GUI? (the psql shell I have is bugged as it never allows me to physically type my password)

    Here's the part where I sound like an idiot:
    do i need
    a do...while loop?
    to create a function?
    what is the iteration symbol for pgSQL? geo%1 or geo+1 or geo&1?

    I just started SQL a month ago so....Help is super appreciated!

    Last edited by econgirl8; 04-24-12 at 14:28. Reason: Typos

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts