title: Go: how to retrieve multiple results from mysql with sql/db package
body: <p>I'm trying to fetch data from a table using the sql/db package in Go. My database table contains a username "shaw". There are a few rows with the username shaw with different posts in the post column attached to it. I have the following code:</p>
  
  <p>GO:</p>
  
  <pre><code>func ReadData() string {
      db, err := sql.Open("mysql", "user1@/my_db")
      if err != nil {
          fmt.Println(err)
      }
      defer db.Close()
  
      var tweet string
  
      rows, err := db.Query("select tweet from posts where username = ?", "shaw")
      if err != nil {
          fmt.Println(err)
      }
      defer rows.Close()
  
      for rows.Next() {
          err := rows.Scan(&amp;tweet)
          if err != nil {
              fmt.Println(err)
          }
          fmt.Printf("this %s", tweet)
          return tweet
      }
      return ""
  }
  </code></pre>
  
  <p>The result shown only gives me 1 value from the table and not the other values associate with "Shaw". How do I fetch more than 1 result?</p>
  
  <p>According to the documentation here there doesn't seem to be anything wrong.. <a href="https://code.google.com/p/go-wiki/wiki/SQLInterface" rel="nofollow">https://code.google.com/p/go-wiki/wiki/SQLInterface</a></p>