Logo SQLinForm

 

Join, Subselect, Case/When Indentions

Join, Subselect, Case/When Indentions
November 12, 2015 10:32PM
Would like to have a couple of more options for indention on Joins, Subselects, and Case statements. Examples below look better with a fixed space font.

Joins aligned with "from" regardless of join type
select *
from table_a
full join table_b
on colb = cola
left join table_c
on colc = cola

Subselects aligned 1 space past bracket

select *
from (
select *
from table_whatever
) as x

and option to set indentation of WHEN under CASE:

case
when something then whatever
when something_else then whatever
else do_nuthin
end

Thanks!
Re: Join, Subselect, Case/When Indentions
November 13, 2015 12:08AM
Hi SamBaugh,
thanks for your suggestions. Unfortunately the formatting got lost
In this forum please use the "Formatted Code" Option to insert SQL code. It uses monospace
and keeps the spaces.
e.g.
SELECT a
      , b
      , C
FROM table t1
            .....



Edited 2 time(s). Last edit at 11/13/2015 12:09AM by guidomarcel.
Re: Join, Subselect, Case/When Indentions
November 17, 2015 11:55PM
Joins aligned with "from" regardless of join type

select *
  from table_a
  full join table_b
    on colb = cola
  left join table_c
    on colc = cola

Subselects aligned 1 space past bracket

select *
  from (
        select *
          from table_whatever
       ) as x

and option to set indentation of WHEN under CASE:

case
  when something then whatever
  when something_else then whatever
  else do_nuthin
end
Author:

Your Email (Optional):


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 13 plus 18?
Message: