• William Gary Wright (5/13/2013)


    I work at a 911 center. Our data is sensitive and proprietary. I also have a contract with our software vendor to not disclose any information about their software. With that in mind this is why I posted the way I did, most of the names I used are not even used in the actual database. I tried to explain what I need without getting into to much detail about the data and I thougt what I sent might be enouigh.

    I will try again.

    I certainly understand sensitive data. Many of us around here work with sensitive data as a normal part of our day. For these types of things you just need obfuscate the data but keep it representative of the issue. Certainly nothing wrong with changing column names and only including columns relevant to the issue at hand. That makes it an example of how to do whatever it is you are doing and does reveal any real actual information.

    I was pretty sure that all you needed was to join those two tables until I ran into this:

    The values for the where clause will come form this query and I need to loop these values through the first query.

    select

    I have no idea what that means.

    I was thinking initially that you wanted something like you were trying to use streetranges columns as some way to validate what is there.

    Completely blind due to no information but here are a couple of shots in the dark.

    Select

    *

    from streets s

    join streetranges sr on sr.streetnumber = s.streetnumber

    join streetranges sr2 on sr.streetname = s.streetname

    OR MAYBE...

    select *

    from streets s

    where

    calltime >= 'Sometime'

    and

    street in (select streetname from streetranges)

    and

    streetnumber >= (select min(streetfrom) from streetranges)

    and

    streetnumber <= (select min(streetto) from streetranges)

    _______________________________________________________________

    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/