Viewing 15 posts - 1,111 through 1,125 (of 1,497 total)
To be fair, DLINQ, with it's dynamic SQL, is good for quickly creating prototypes. Also, if you decide to cache some data as XML, it saves having to know too...
January 16, 2008 at 4:44 am
I started the query with the PO_MX table as you were looking for PONumbers - I find this easier but you can start with any table you like.
You should also...
January 16, 2008 at 4:07 am
In addition, derived tables, also known as inline views, could be used instead of HAVING:
SELECT PO_MX.PONumber
FROM PO_MX
    JOIN
    (
        SELECT EJ.PONumber, SUM(EJ.Amount) AS Amount
        FROM EJ
        GROUP BY EJ.PONumber
    ) D1
    ON PO_MX.PONumber = D1.PONumber
    JOIN
    (
        SELECT PO_DX.PONumber, SUM(PO_DX.QuantityOrdered...
January 15, 2008 at 3:21 am
Without DDL and test data it is difficult to know what you want.
Maybe you need to use the ROW_NUMBER() function like:
SELECT *
FROM
(
    SELECT ROW_NUMBER() OVER (PARTITION BY S.sessie_id ORDER BY S.created_date)...
January 9, 2008 at 10:10 am
1. Create a #temp table with an IDENTITY column
2. Insert your data into the #temp table
3. Join the #temp table to a derived table containing the MINIMUM(ID) for each tans_code...
January 9, 2008 at 7:24 am
In SQL2000 you will need to use a #temp table:
January 9, 2008 at 7:06 am
The UNIONS are test data! (Read the comments.)
Just use the query and replace the test tables with your tables.
January 9, 2008 at 6:33 am
-- *** Test Data ***
DECLARE @t1 TABLE
(
    Initials varchar(10) NOT NULL
    ,EffectiveDate datetime NOT NULL
    ,RatePerHour money NOT NULL
)
INSERT INTO @t1
SELECT 'aaaa', '20050101', 150 UNION ALL
SELECT 'aaaa', '20050705', 200 UNION ALL
SELECT 'aaaa', '20050901',...
January 9, 2008 at 5:23 am
Without the rest of your tables (P as in P.Tran_ID?) and the rest of the WHERE clause, your post does not make sense.
December 11, 2007 at 7:35 am
Try:
INSERT INTO table_geography
SELECT @geolevel
WHERE NOT EXISTS
(
    SELECT *
    FROM table_geography G WITH (UPDLOCK )
    WHERE G.geolevel = @geolevel
)
December 11, 2007 at 7:01 am
I have a note that the following should work in 2005. (I must have seen it on a forum somewhere.) I have never tried it as ADO/ADO.Net seems less hassle.
CREATE...
December 6, 2007 at 7:49 am
Gail is right to say that order is meaningless in a SQL table, however order does have meaning in your Excel worksheet. In order to retain this order in SQL...
December 4, 2007 at 5:39 am
JReed,
I find all the unneeded brackets in code makes it difficult to read. I have reformatted it as follows:
SELECT DISTINCT
    Accounts.UID
    ,Accounts.Fname + ' ' + Accounts.MI AS Fname
    ,Accounts.Lname...
November 30, 2007 at 8:11 am
Your queries are running correctly, NOT IN and NOT EXISTS are not the same when there are NULLs involved and ANSI_NULLs are on. (Your data must have NULLs in the...
November 29, 2007 at 8:51 am
Try casting to bigint and using the fnNumber2AnyBase function at the following link.
November 28, 2007 at 5:26 am
Viewing 15 posts - 1,111 through 1,125 (of 1,497 total)