alright, So i'm kind of an SQL noob here, wonderin...
# sql
m
alright, So i'm kind of an SQL noob here, wondering how i format a response from a query so that each selected field is it's own column, anybody have any ideas or know where to point me?
s
Can you give an example of what you mean?
m
So I'm running a query to get all users that have signed up within a specific time frame. I', getting the correct data on response, but I want to break it up into columns, like: firstName || lastName || dateJoined || email Carl Sagan 10/21/2021 carlsagan42@gmail.com if that makes sense
s
No as that would be done in your userland code and not in the SQL query
The SQL query would return a JSON when using the Supabase library, so it would already have column name along with value
m
well currently when I run the sql query it's just showing row (firstName, lastName, dateJoined, email)
s
Copy code
json
{
  firstName: "Carl",
  lastName: "Sagan",
  dateJoined: "10/21/2021",
  email: "carlsagan42@example.com"
}
Yes that's how SQL queries work, but when you call it via the
supabase-js
client library it will return like the above
m
right okay, that makes sense. so would I have to create a view or something to get it formatted how I want it?
s
What does your query look like? if its a simple select you can just use the
supabase-js
library to do it
m
I actually figured it out, the problem was coming from me putting the column names in parentheses
s
ok cool
Happy to hear you have resolved it
m
but I'm well aware you can do this all through the library and it would make my life way easier, but that's not how the guy i'm working for wants it done
and the customer is always right of course lol
s
hehe
Just note you are the developer, so if the customer isn't the developer working on the project, they should be taking your recommendation
m
You are right x10000, thank you