query help to find breakdown of operations

  • Hi All. Below is an example table of what i need to query out of:

    Patient Name|| Patient No.|| Age|| Cancer||Consultant|| Operation||Admiision Date|| Date of Operation ||

    Joe Bloggs ||123 || 25 || Yes|| Dr Smith || Back || 01/01/2013 || 03/01/2013

    Joe Bloggs2 || 321 || 29 || NO ||Dr loggs || Spine || 02/01/2013 || 04/01/2013

    John Doe || 534 || 34 || No || Dr Doe || Hip || 03/01/2013 || 05/01/2012

    i need a query to breakdown different types of operations and the length of stay for each operation which is presume is between admission and operation dates. thanks for any help 😉

  • prb88 (5/9/2013)


    Hi All. Below is an example table of what i need to query out of:

    Patient Name|| Patient No.|| Age|| Cancer||Consultant|| Operation||Admiision Date|| Date of Operation ||

    Joe Bloggs ||123 || 25 || Yes|| Dr Smith || Back || 01/01/2013 || 03/01/2013

    Joe Bloggs2 || 321 || 29 || NO ||Dr loggs || Spine || 02/01/2013 || 04/01/2013

    John Doe || 534 || 34 || No || Dr Doe || Hip || 03/01/2013 || 05/01/2012

    i need a query to breakdown different types of operations and the length of stay for each operation which is presume is between admission and operation dates. thanks for any help 😉

    Not exactly sure what you are looking for here. Can you post this as a create table and insert statements? Then if you could explain what you want as output based on the sample we can help you pretty quickly and easily.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • its ok its done thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply