I have a select query with a subquery as a column:
select name, (select count(*) from children), address, city from parents
John, 2, 123 Johnson St, Chicago
Fred, 0, 456 Jackson Ave, Chicago
Mark, 1, 789 Jordan Rd, Chicago
This is a dummied down version of what I need to do. But what I want is to instead of returning the count, I want to have the query return a value if the count is 0, and another value if it's greater than 0. Like this:
John, True, 123 Johnson St, Chicago
Fred, False, 456 Jackson Ave, Chicago
Mark, True, 789 Jordan Rd, Chicago
Is there an easy way to do this?
Thanks all.
select name, (select count(*) from children), address, city from parents
John, 2, 123 Johnson St, Chicago
Fred, 0, 456 Jackson Ave, Chicago
Mark, 1, 789 Jordan Rd, Chicago
This is a dummied down version of what I need to do. But what I want is to instead of returning the count, I want to have the query return a value if the count is 0, and another value if it's greater than 0. Like this:
John, True, 123 Johnson St, Chicago
Fred, False, 456 Jackson Ave, Chicago
Mark, True, 789 Jordan Rd, Chicago
Is there an easy way to do this?
Thanks all.