Question: I am a total newbie at coding but I made a simple script:

```
import time
import keyboard

while True:
    try:
        if keyboard.is_pressed('F3'):
            time.sleep(1)
            keyboard.press('enter')
            continue
    except:
        break

```

When I press F3, the script makes the computer press the Enter key. The problem is it only does it once until you press F3 again.

How can I make it go forever until I press F3 to stop it?

Answer: 
You can do with Common Table Expression with CASE's like

```
@Query("WITH parms(c) AS (SELECT :columnName) " +
        "SELECT  COALESCE(" +
        "CASE " +
        "WHEN (SELECT c FROM parms) = 'column1' THEN column1 " +
        "WHEN (SELECT c FROM parms) = 'column2' THEN column2 " +
        "WHEN (SELECT c FROM parms) = 'column3' THEN column3 " +
        "WHEN (SELECT c FROM parms) = 'column4' THEN column4 " +
        "END" +
        ",0) AS subcategoryValue " +
        "FROM subcategory_table" +
        ";")
float[] getSubcategory(String columnName);

```

The Subcategory class not needed and is less efficient, but could use if wanted change `float[] getSubcategory(String columnName);` to `List<Subcategory> getSubcategory(String columnName);`
Normal SQL would simply use

```
SELECT COLUMN1, COLUMN2, COLUMN3, COLUMN4 from <TABLE>

```

so probably something like

```
@Query("SELECT " + desiredSubcategory1 + " AS subcategoryValue1 + "," +
desiredSubcategory2 + " AS subcategoryValue2 + "," +
desiredSubcategory3 + " AS subcategoryValue3 + "," +
desiredSubcategory4 + " AS subcategoryValue4 + "," +
"FROM subcategory_table")
List<Subcategory> getSubcategory(String desiredSubcategory);

```