David72
David72

Reputation: 39

Cannot parse SQL result count from Logic App

I run this simple query in Logic App using the "Execute a SQL query (V2)" connector to find out if a number exists in my table.

select count(*) from users where user_number='724-555-5555';

If the number exist, I get this JSON , but somehow I cant parse it.

[
  {
    "": 1
  }
]

Any idea how to simply retrieve 0 or 1 ? Thanks David

Upvotes: 0

Views: 851

Answers (1)

Dai
Dai

Reputation: 155618

You need to add an explicit column name:

SELECT
    count(*) AS cnt
FROM
    users
WHERE
    user_number = '724-555-5555';

That will give you this result:

[ { "cnt": 1 } ]

...which is valid JSON.

Upvotes: 2

Related Questions