andyou'd want to put the standard inline sql formatting *back in*each
column named and on a seperate line, delimiting columns aligned, table names
aliased and aligned, reserved words in caps, conditions aligned (=, !=, IN,
NT IN, etc.)regardless of select, insert, update, etc.
and that's not just *my* pet-peave. the more complex the query, view, proc,
or udf the more the differences are noticed and appreciated.
"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
@comcast.com
| robert wrote:
| | The solution is:
| |
| | select grad_pbroj, Naziv, ****(*) as brojac from smjestaj left join
grad
| on
| | grad.grad=smjestaj.grad_pbroj group by grad_pbroj order by grad_pbroj
ASC
| >
| >
| i don't think sothat should cough up a nasty error as "naziv" is not
| handled in the group by clause nor is it part of an aggrigate
functionand
| that's just me eye-balling it for .5 seconds.
| >
| btwpeople who DNT format their inline sql should be shot! which is
more
| manageable, the above or:
| >
| SELECT s.grad_pbroj ,
| s.Naziv ,
| ****(*) brojac
| FRM smjestaj s
| LEFT JIN grad g N
| g.grad = s.grad_pbroj
| GRUP BY s.grad_pbroj ,
| s.Naziv
| RDER BY s.grad_pbroj ASC
| >
| >
| ** and if this query is to return the number of duplicates, then there
| should either be a where or having clause that only returns a row if the
| count is 1.
| >
| but that's just me following real-world, professional standards. the
former
| should just be all on one line for christ' sake.
| >
| >
|
| Close - you would need a HAVING clause:
|
| SELECT s.grad_pbroj, s.Naziv, ****(*) AS brojac
| FRM smjestaj s
| LEFT JIN grad g N g.grad = s.grad_pbroj
| GRUP BY s.grad_pbroj,s.Naziv
| HAVING ****(*) 1
| RDER BY s.grad_pbroj ASC
|
| --
|
| Remove the "x" from my email address
| Jerry Stuckle
| JDS Computer Training Corp.
| jstucklex@attglobal.net
|