title: How to loop in output of postgresql query into a variable using windows batch
body: <p>I have a multi line SQL code where I want to store a single column with multiple rows into a variable. Can someone please help me with this? 
  I am new to batch and learning but this is something I am finding difficulty with.</p>
  
  <p>Heres what my SQl query in batch looks like:</p>
  
  <p>SQl Query:
  Select email,username 
  from table1,table2, table3 
  where table1.id = table2.id 
  and table1.id=table3.id
  and table1.somefilter
  and table2.somefilter;
  I am storing the output of the same into a folder which is denoted below as "C:\filelocation"</p>
  
  <p>psql -d Database -p 8000 -U username -t -A -f C:\filelocation -o "C:\text.txt"</p>
  
  <p>Output: 
  abc@abc.com abc
  xyz@abc.com xyz</p>
  
  <p>So this is a list of email addresses and their associated usernames. So, I would like to put them in a variable.</p>
  
  <p>I am using -f as it is a multi line sql query with 2 different columns and multiple rows.</p>
  
  <p>I have managed to get the output of the query into a folder, but what I really want is that I want to loop them into a variable.</p>
  
  <p>Thanks</p>