Sunday, August 2, 2009

Complex TSQL - Reccommend some reading or training.?

I'm having problems at work. We're doing conversion from an old table schema to a new table schema, and we're doing it in an ASP application (application service provider, not the microsoft technology with the same name). So we're doing it for one facillity at at time. I need some resources to figure out how to write the more complex sql stuff. I know the bascis but we need to write code like this all day %26amp; i'm stumbling on it.





Its typically an insert with multiple subqueries, and corelated subqueries all in the same statement.





like


insert into xxx


(columns)


select xx, yy, zz,


(


select weird column from 3rd table


where a.xx = c.xx


and


yy = c.yy


and


zz = c.zz


)


from tbl_c c


where facilityid = @facilityid


etc...

Complex TSQL - Reccommend some reading or training.?
The best way of learning SQL is really understanding what you want to be doing, the psuedo code that you have there is all good, but sql is so simple to read that you can write the same thing in code and it is still perfectely readable. If you read one particular query and really break it down in your mind and understand exactly what it is that you want and how it is doing that you will find it easy to begin writing different queries. I find it easier to keep reminding myself that i am describing to the program which rows/columns to update/create/delete.





Good luck
Reply:That is quite complicated, you may also post your question at websites like http://askexpert.info/

baby breath

No comments:

Post a Comment