Forum Replies Created

Viewing 15 posts - 556 through 570 (of 600 total)

  • RE: Need some help on this query

    It seems to me that the issue is the result of a strange design. The only way to determine how long a customer has continuously been a customer is...

  • RE: one-to-many relationship select query

    Here's how I would do it with the datestamp field:

    CREATE Table #Table_A (A_ID INT,F_Name VARCHAR(2), M_Name VARCHAR(2),L_Name1 VARCHAR(2))

    INSERT INTO #Table_A

    SELECT 1,'A','B','C'UNION ALL

    SELECT 2,'X','Y','Z'

    CREATE Table #Table_B(B_ID INT,A_ID INT,City...

  • RE: one-to-many relationship select query

    bitbucket-25253 (7/31/2010)


    Nevyn changed my create table statements to use your table names and ran your code:

    SELECT *

    FROM Table_A a

    LEFT OUTER JOIN

    ...

  • RE: one-to-many relationship select query

    helpdesk-1100431 (7/30/2010)


    Hello to all,

    I am a having trouble in querying one-to-many relationship. let me describe the scenario here. my table structure is like this.

    Table A

    A_IDF_NameM_NameL_Name

    1ABC

    2XYZ

    Table B

    B_IDA_IDCityStateZip

    11xxxTN37013

    21yyyTX37012

    Now i want to select...

  • RE: Select an ID that matches data from mutiple rows

    This is what I came up with (and also test data for people to find a better solution):

    CREATE TABLE #codes (CodeIDint,

    Codechar(4)

    )

    CREATE TABLE #sequences (SequenceIDint,

    CodeIDint,

    Seqint,

    DecisionIDint)

    INSERT INTO #codes (CodeID,Code)

    SELECT 1,'0001' UNION ALL

    SELECT...

  • RE: Select an ID that matches data from mutiple rows

    That doesn't quite work, Scott. It will also return any subset matches (with his test data your query returns codes 0001 and 0002)

  • RE: Select an ID that matches data from mutiple rows

    I assume the sequence must also be correct?

    For example a user entering 2999,3000 matches code 0002. what if it's 3000, 2999 (same numbers, different sequence) instead?

  • RE: Select an ID that matches data from mutiple rows

    I'll give this a shot tonight. There are a few ways you could do it.

    Can there be only one matching code to a given sequence?

  • RE: Select an ID that matches data from mutiple rows

    Is this in a stored procedure? Can you give us an idea of the input you get sent from the user and the format it is in.

    It sounds like...

  • RE: Index issues

    Just an observation, but you say date time is formatted in yyyymmdd, but when you posted the query your between clause

    was :

    WHERE [StartTime] BETWEEN 20102209112223 AND 20102309112223

    ... which is...

  • RE: Cursor Output

    Can you post the create table script for arttemp? Even better would be the scripts for each table in your procedure, and some sample data scripted as insert commands...

  • RE: Cursor Output

    Do you need both the print AND the data stored in a table, or do you need the data stored in a table INSTEAD? What are you using the...

  • RE: Having problem with datetime column to execute

    Ish Fad (7/29/2010)


    thanks

    I uesd store procedure as advice my above. But I am still getting this error;

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)

    [Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data...

  • RE: Cursor Output

    Jeff Moden (7/29/2010)


    Paul White NZ (7/29/2010)


    There is a (very nasty) one-step global cursor + dynamic sql workaround, which Jeff is just going to love:

    Heh... I AM curious why you'd show...

  • RE: How to extract a values from the table

    Can you post DDL?

    I THINK your routeplaces table has a row for each place, but the way you posted the sample data makes it look like there is one row...

Viewing 15 posts - 556 through 570 (of 600 total)