---
title: "Gateway-SQL - How to make the \"order by\" statement work in the gateway-sql plugin"
description: "The Gateway-SQL plugin requires defining columns and their types in the table definition for the \"order by\" statement to work. Once columns and types are defined, sorting will occur automatically in queries."
url: "https://docs.itrsgroup.com/docs/faq/geneos/115004028409-geneos-gateway-sql-how-to-make-the-order-by-statement-work-in-the-gateway-sql-plugin/index.html"
---
**You need to define the columns and type in the table definition**

1. When you define the source tables in the gateway-sql plugin, ensure that you define the columns and its corresponding type: Geneos - Gateway-SQL - How to make the "order by" statement work in the gateway-sql plugin 2. Once defined, the sorting should take place automatically. Geneos - Gateway-SQL - How to make the "order by" statement work in the gateway-sql plugin select \* from T2 order by value  Geneos - Gateway-SQL - How to make the "order by" statement work in the gateway-sql plugin


