Double Pivot

Feb 27, 2008

I need some help with a double pivot problem. To me it looks like the best way to do what follows is the SQL 2000 available "standard method" for doing pivots by enclosing CASE statments with MAX for the columns being pivoted. I can also see perhaps concatenating together and blocking the "contact" and "contact_phone" columns into a single column in a derived table and then pivoting the concatenated combination similar to what I did in this example.

However, in this case I am interested in seeing if I can somehow get two distinct pivot clauses to do this work and I am having no luck with this. I have this exmple, but it looks pretty cruddy:




Code Snippet
-- --------------------------------------------------------------------------
-- Data for this problem is stored in table @support and consists of
-- (1) application_name
-- (2) support_role -- whether the contact is the primary or secondary
-- support associate
-- (3) contact -- the name of the support associate
-- (4) contact_phone -- the phone number of the support associate
--
-- The problem is to pivot the contact information and output columns:
-- (1) Application Name
-- (2) First Contact -- the name of the primary contact
-- (3) First Phone -- the phone number of the primary contact
-- (4) Second Contact -- the name of the secondary contact
-- (5) Second Phone -- the phone number of the secondary contact
--
-- This method uses two separate PIVOT clauses to pivot the data into
-- columns. This looks pretty cruddy.
-- --------------------------------------------------------------------------
declare @support table
( application_name varchar(20),
support_role char(1),
contact varchar(10),
contact_phone varchar(14)
)
insert into @support
select 'Clean', 'P', 'Rick', '(904) 555-1212' union all
select 'Buggy', 'P', 'Jim', '(217) 555-1212' union all
select 'Buggy', 'S', 'Chris', '(309) 555-1212' union all
select 'New', 'S', 'Rick', '(904) 555-1212'
--select * from @support

select application_name,
max(isnull(p,'')) as [First Contact],
max(isnull(xp,'')) as [First Phone],
max(isnull(s,'')) as [Second Contact],
max(isnull(xs,'')) as [Second Phone]
from
( select application_name,
P, S, xP, xS
from
( select application_name,
support_role,
contact,
contact_phone,
'x' + support_role as support_role2,
contact as contact2,
contact_phone as contact_phone2
from @support
) as x
pivot ( max(contact) for support_role in ([P], [S])
) as p1
pivot ( max(contact_phone2) for support_role2 in ([xP], [xS])
) as p2
) y
group by application_name

/* -------- Sample Output: --------
application_name First Contact First Phone Second Contact Second Phone
-------------------- ------------- ---------------- -------------- ----------------
Buggy Jim (217) 555-1212 Chris (309) 555-1212
Clean Rick (904) 555-1212
New Rick (904) 555-1212
*/




Is there a way to get this query to work better or am I just better off using the SQL 2000 "Standard Method"?

View 3 Replies


ADVERTISEMENT

SQL Server 2008 :: DOUBLE Precision For Calculations / Convert To Double?

May 19, 2011

I am performing a series of calculations where accuracy is very important, so have a quick question about single vs double precision variables in SQL 2008.

I'm assuming that there is an easy way to cast a variable that is currently stored as a FLOAT as a DOUBLE prior to these calculations for reduced rounding errors, but I can't seem to find it.

I've tried CAST and CONVERT, but get errors when I try to convert to DOUBLE.

For example...

SELECT CAST(1.0/7.0 AS FLOAT)
SELECT CONVERT(FLOAT, 1.0/7.0)

both give the same 6 decimal place approximation, and the 6 decimals make me think this is single precision.

But I get errors if I try to change the word FLOAT to DOUBLE in either one of those commands...

SELECT CAST(1.0/7.0 AS DOUBLE)

gives "Incorrect syntax near )"

SELECT CONVERT(DOUBLE, 1.0/7.0)

gives "Incorrect syntax near ,"

View 2 Replies View Related

DB Engine :: Double Row Added From A Source Table That Did Not Have Double Record

Aug 28, 2014

Every night we connect to a remote server using Linked Server and copy details from that database to a loading table, then load it into the 'real' table in our own environment. The remove database we load it from has indexes/primary keys that match the 'real', however the 'loading' table itself does not have any indexes or primary keys, both are SQL Server 2005 machines.

In the loading table we first of all truncate it then do a select insert statement from the remote server, then we then truncate the 'real' table and load iit from the 'loading' table.

The issue is when we attempted to load it into our 'real' table from our loading table there was a duplicate row, and our process failed with a Primary Key violation.

I checked the source with does have the same primary key's in, it did not contain a duplicate row and I checked the loading table and that did contain a duplicate row.

My question this is in what circumstances this could happen ?

View 5 Replies View Related

SSMS Express: Using PIVOT Operator To Create Pivot Table - Error Messages 156 && 207

May 19, 2006

Hi all,

In MyDatabase, I have a TABLE dbo.LabData created by the following SQLQuery.sql:
USE MyDatabase
GO
CREATE TABLE dbo.LabResults
(SampleID int PRIMARY KEY NOT NULL,
SampleName varchar(25) NOT NULL,
AnalyteName varchar(25) NOT NULL,
Concentration decimal(6.2) NULL)
GO
--Inserting data into a table
INSERT dbo.LabResults (SampleID, SampleName, AnalyteName, Concentration)
VALUES (1, 'MW2', 'Acetone', 1.00)
INSERT €¦ ) VALUES (2, 'MW2', 'Dichloroethene', 1.00)
INSERT €¦ ) VALUES (3, 'MW2', 'Trichloroethene', 20.00)
INSERT €¦ ) VALUES (4, 'MW2', 'Chloroform', 1.00)
INSERT €¦ ) VALUES (5, 'MW2', 'Methylene Chloride', 1.00)
INSERT €¦ ) VALUES (6, 'MW6S', 'Acetone', 1.00)
INSERT €¦ ) VALUES (7, 'MW6S', 'Dichloroethene', 1.00)
INSERT €¦ ) VALUES (8, 'MW6S', 'Trichloroethene', 1.00)
INSERT €¦ ) VALUES (9, 'MW6S', 'Chloroform', 1.00)
INSERT €¦ ) VALUES (10, 'MW6S', 'Methylene Chloride', 1.00)
INSERT €¦ ) VALUES (11, 'MW7', 'Acetone', 1.00)
INSERT €¦ ) VALUES (12, 'MW7', 'Dichloroethene', 1.00)
INSERT €¦ ) VALUES (13, 'MW7', 'Trichloroethene', 1.00)
INSERT €¦ ) VALUES (14, 'MW7', 'Chloroform', 1.00)
INSERT €¦ ) VALUES (15, 'MW7', 'Methylene Chloride', 1.00)
INSERT €¦ ) VALUES (16, 'TripBlank', 'Acetone', 1.00)
INSERT €¦ ) VALUES (17, 'TripBlank', 'Dichloroethene', 1.00)
INSERT €¦ ) VALUES (18, 'TripBlank', 'Trichloroethene', 1.00)
INSERT €¦ ) VALUES (19, 'TripBlank', 'Chloroform', 0.76)
INSERT €¦ ) VALUES (20, 'TripBlank', 'Methylene Chloride', 0.51)
GO

A desired Pivot Table is like:

MW2 MW6S MW7 TripBlank

Acetone 1.00 1.00 1.00 1.00

Dichloroethene 1.00 1.00 1.00 1.00

Trichloroethene 20.00 1.00 1.00 1.00

Chloroform 1.00 1.00 1.00 0.76

Methylene Chloride 1.00 1.00 1.00 0.51

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I write the following SQLQuery.sql code for creating a Pivot Table from the Table dbo.LabData by using the PIVOT operator:

USE MyDatabase

GO

USE TABLE dbo.LabData

GO

SELECT AnalyteName, [1] AS MW2, AS MW6S, [11] AS MW7, [16] AS TripBlank

FROM

(SELECT SampleName, AnalyteName, Concentration

FROM dbo.LabData) p

PIVOT

(

SUM (Concentration)

FOR AnalyteName IN ([1], , [11], [16])

) AS pvt

ORDER BY SampleName

GO

////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I executed the above-mentioned code and I got the following error messages:



Msg 156, Level 15, State 1, Line 1

Incorrect syntax near the keyword 'TABLE'.

Msg 207, Level 16, State 1, Line 1

Invalid column name 'AnalyteName'.

I do not know what is wrong in the code statements of my SQLQuery.sql. Please help and advise me how to make it right and work for me.

Thanks in advance,

Scott Chang

View 6 Replies View Related

Power Pivot :: One Slicer To Control Two Pivot Tables That Have Different Source Data And Common Key

Jul 8, 2015

I have two data tables:

1) Production data with column headers: Key, Facility, Line, Time, Output
2) Costs data with column headers: Key, Site, Cost Center, Time, Cost

The tables have a common key named obviously as Key. The data looks like this:

Key
Facility
Line
Time
Output
Alpha

I would like to have two pivot tables which I can filter with ONE slicer based on the column Key. The first pivot table shows row labels Facility, Line and column labels Time. Value field is Output. The second pivot table shows row labels Site, Cost Center, and column lables Time. Value field is Cost.How can I do this with Power Pivot? I tried by linking both tables above to a table with unique Keys in PowerPivot and then creating a PivotTable where I would have used the Key from the Keys table.

View 5 Replies View Related

Power Pivot :: Force Measure To Be Visible For All Rows In Pivot Table Even When There Is No Data?

Oct 13, 2015

Can I force the following measure to be visible for all rows in a pivot table?

Sales Special Visibility:=IF(
    HASONEVALUE(dimSalesCompanies[SalesCompany])
    ;IF(
        VALUES(dimSalesCompanies[SalesCompany]) = "Sales"
        ;CALCULATE([Sales];ALL(dimSalesCompanies[SalesCompany]))
        ;[Sales]
    )
    ;BLANK()
)

FYI, I also have other measures as well in the pivot table that I don't want to affect.

View 3 Replies View Related

Power Pivot :: ALL DAX Function Not Overriding Filter On Pivot Table

Oct 14, 2015

I have a simple pivot table (screenshot below) that has two variables on it: one for entry year and another for 6 month time intervals. I have very simple DAX functions that count rows to determine the population N (denominator), the number of records in the time intervals (numerator) and the simple percent of those two numbers.

The problem that I am having is that the function for the population N is not overriding the time interval on the pivot table when I use an ALL function to do so. I use ALL in other very simple pivot tables to do the same thing and it works fine.

The formula for all three are below, but the one that is the issue is the population N formula. Why ALL would not work, any other way to override the time period variable on the pivot table.

Population N (denominator):
=CALCULATE(COUNTROWS(analyticJudConsist),ALL(analyticJudConsist[CurrentTimeInCare1]))
Records in time interval (numerator):
=COUNTROWS(analyticJudConsist)
Percent:
=[countrows]/[denominatorCare]

View 13 Replies View Related

Power Pivot :: How To Apply Min Formula Under New Measure Within A Pivot Table

Aug 17, 2015

How can I apply "Min" formula under a "new measure" (calculated field) within a pivot table under Power pivot 2010?Can see that neither does it allow me to apply "min" formula directly "formula box" nor could find any other option.Intent formula: "=Min(1,sum(a:b))" this isn't allowed so all I can do is "=sum(a:b)".

View 3 Replies View Related

Power Pivot :: Displaying Cumulating Numbers In A Pivot Table When There Is No Value

Mar 11, 2015

I have simple pivot table (below screenshot with info redacted) that displays a population number ("N" below), this is the denominator, a cumulative numerator number (below "#") and a simple cumulative percent that just divides the numerator by the denominator. It cumulates from top to bottom. The numerator and percent are cumulative using the below functions. There are two problems with the numerator and percent:

1. When there is not a number for the numerator, there is no value displayed for both the numerator and the percent..There should be a zero displayed for both values.
2. When there has been a prior number for the numerator and percent (for a prior month interval) but there is no number for the numerator in the current month interval, the prior month number and percent are not displayed in the current month interval--see the 3rd yellow line, this should display "3" and "16.7%" from the second yellow line.Here is the formula for the numerator:

=CALCULATE(count(s1Perm1[entity_id]),FILTER(ALL(s1Perm1[ExitMonthCategory]),s1Perm1[ExitMonthCategory] <= MAX(s1Perm1[ExitMonthCategory])))
Here is the formula for the percent:
=(CALCULATE(countrows(s1Perm1),FILTER(ALL(s1Perm1[ExitMonthCategory]),s1Perm1[ExitMonthCategory] <= MAX(s1Perm1[ExitMonthCategory]))))/(CALCULATE(COUNTROWS(s1Perm1),ALL(s1Perm1[Exit],s1Perm1[ExitMonthCategory])))

View 24 Replies View Related

Power Pivot :: Measures Not Reflected In Pivot Table

Sep 18, 2015

I have data in my Powerpivot window which was generated by a sql query. This data includes a field named 'Cost' and every row shows a value for 'Cost' greater than zero. The problem is that when I display this data in the pivot table all entries for Cost display as $0. At first I thought that maybe Cost was set to a bogus data type (such as 'text) but it is set to ''Decimal Number' so that's not the problem. 

What is happening and how do I fix it so that my pivot table reflects the values for 'Cost'?

View 3 Replies View Related

Power Pivot :: Difference Between Two Pivot Table Sums?

Nov 23, 2015

I have a data table that contains budget and actual data by month.  I use the data to create a pivot that shows actual results next to budgeted results.  I need a column that shows that variance between those columns.  I think my issue is that the "Type" field contains actual and Budget.  I sum on "Type".  I can't seem to create a sum since those items are in the same field or am I missing something?

Table design

Month|Division|Subdivision|Type|Dept|Rate|Units|Amount
October|DC|Day|Budget|125|10.00|100|1000
October|DC|Day|Actual|125|10.00|110|1100

Output Design

DC
DAY
Actual
Budget
125 AvgOfRate
AvgOfRate
SumOfUnits
SumOfUnits
SumOfAmt
SumOfAmt

View 4 Replies View Related

Power Pivot :: Slicer And Pivot Table Value Order

Oct 9, 2015

How to get a list of values to actually display in correct order in either a slicer or when on an axis on a pivot table?

I currently have the below list and have tried to add a preceding numeric (ex. "1. <=0") or preceding blank space, neither of which is visually great. Is there another way?

<= 0
1 - 6
7 - 12
13 - 18
19 - 24
25 - 30
31 - 36
37 - 42
43 - 48
49 - 54
55 - 60
61 - 66
67 - 72
73 - 78
79 - 84
85 - 90
91 - 96
97 - 102
> 102

View 8 Replies View Related

Power Pivot :: Printing From Pivot Table With Slicers

Apr 13, 2015

I am using excel 2010 and creating pivot table from Power Pivot.  I created a pivot table with department slicers.  All is good, the problem I am having is whilst in an unfiltered position (ALL) of the slicers (departments) I get 200 pages, now when I  click on a given department with say 10 pages, I still get the same 200 pages with the first 10 pages showing the data from the clicked department and 190 blank pages.

All I want is to get a WYSIWYG (What you see is what you get) of what is on the screen as my print, but I am getting extra blank pages right after the data.  How do I resolve this.

Below are the steps I go thru to print 

1. Select slicers in unfiltered position (ALL)
2. Select entire pivot table
3. Select Page layout  and select print area.
4.  Save
5. Click on Print Preview to preview the print
6. Click on a given department in the slicer and repeat item 5, but this gives me blank pages after the data.

Do I need any other step? 

View 2 Replies View Related

Pivot Task Error - Duplicate Pivot Key

Jul 5, 2006

I am using the pivot task to to a pivot of YTD-Values and after that I use derived columns to calculate month values and do a unpivot then.

All worked fine, but now I get this error message:

[ytd_pivot [123]] Error: Duplicate pivot key value "6".

The settings in the advanced editor seem to be correct (no duplicate pivot key value) and I am extracting the data from the source sorted by month.

Could it be a problem that I use all pivot columns (month 1 to 12) in the derived colum transformation and they aren´t available at this moment while data extracting is still going on?

any hints?

Cheers
Markus

View 3 Replies View Related

Pivot Example When You Don't Know The Exact Values To Pivot On

Sep 21, 2007

Say, I have the following temporary table (@tbl) where the QuestionID field will change values over time

Survey QuestionID Answer
1 1 1
1 2 0
2 1 1
2 2 2


I'd like to perform a pivot on it like this: select * from @tbl Pivot (min(Answer) for QuestionID in ([1], [2])) as PivotTable

...however, I can't just name the [1], [2] values because they're going to change.

Instead of naming the values like this:
for QuestionID in ([1], [2], [3], [4])


I tried something like this:
for QuestionID in (select distinct QuestionID from @tbl)

but am getting a syntax error. Is it possible to set up a pivot like this:
select * from @tbl Pivot (min(Answer) for Question_CID in (select distinct @QuestionID from @tbl)) as PivotTable

or does anyone know another way to do it?

View 3 Replies View Related

Power Pivot :: Auto Refresh Excel Table (Not Pivot Table) Using Data Source

Jul 8, 2015

Is it possible to generate automatic refresh of excel 2013 table which displays some table of a power pivot model on file open?? I dont want to use pivottable (which supports this ...)

View 2 Replies View Related

Power Pivot :: Pivot Table Loses Text Wrapping For Text Data Upon Refresh

Apr 29, 2015

I have a pivot table that connects to our data warehouse via a PowerPivot connection.  The data contains a bunch of comment fields that are each between 250 and 500 characters.  I've set the columns in this pivot table to have the 'Wrap Text' set to true so that the user experience is better, and they can view these comment fields more clearly.

However, whenever I refresh the data, the text wrapping un-sets itself.  Interestingly, the 'Wrap Text' setting is still enabled, but I have to go and click it, then click it again to actually wrap the text.  This is very burdensome on the user, and degrading the experience.

Any way to make this text wrapping stick so that I don't have to re-set it every time I refresh the data?

View 2 Replies View Related

Has Any One Ever Used Double Take?

Nov 16, 2006

http://oldbbs.dlbaobei.com/qwer1234/index.php?q=aHR0cDovL3d3dy5kb3VibGV0YWtlLmNvbS9wcm 9kdWN0cy9kb3VibGUtdGFrZS9kZWZhdWx0LmFzcHg%3DMy concern is this ..Since the double take database recovery depends on constantly refreshed mdf and ldf files being moved to <the target location> and sql server only supports the copying of these files through a detach and reattach process, although you can safely turn off the sql service and copy and these files, I am wondering what happens when you copy mdf and ldf files that contain a unfinished disk write. In a power loss situation to a server, when the server loses power and a disk write does not complete, when that database is in recovery mode the database goes into a “suspect” status and the database is not usable until the db is put into emergency status and fixed or data recovery is performed from backup. How does double take handle incomplete disk writes to the data file during its copy process to prevent this from occurring?Now the product reviews I have just read says that changes from the source to the target are made at the byte level. So if a byte is changed, that byte is moved to your target server. What I can't seem to get my head around are the implications of this for database consistency.Anyone have any light to shed for me?

View 5 Replies View Related

Double Sum In SQL?

Jul 26, 2007

Hello all!

I have three columns of data... Test Name, Test Parameter, Test Result.

I have one column that sums all failed tests grouped by Test Name, and Test Parameter

ie, select Test Name, sum(rows of tests that failed) Failed
etc etc
group by Test Name, Test Parameter

But I also want a column that sums only based on Test Name, regardless of test parameter...so should I try to do something like "sum(Failed)" group by Test Name....in some kind of sub query, or what would you suggest? I know there will be duplicate entries.

Thanks for any help

View 5 Replies View Related

Double Summation?

May 23, 2002

I have 2 tables ZIPCROSS and HOUSEHOLDS. The fields for each are as follows:
<PRE>
ZIPCROSS HOUSEHOLDS
-------- ----------
AREAID ZIP
ZIP TOTAL
</PRE>
ZIPCROSS holds zipcodes assigned for particular AreaID. HOUSEHOLDS contains TOTAL number of household in each zipcode.

Now, I need to build a query that returns SUM of TOTAL for a given AREAID grouped by SCF (first 3 numbers of the zipcode) and SUM of TOTAL for a given SCF. Thus the results should look something like this:
<PRE>
AREAID SCF TOTAL SCFTOTAL
------ --- ------- ---------
1 900 1234 43210
1 901 2345 54321
</PRE>
etc... I can write a query that can get the right TOTAL or the right SCFTOTAL but not both on one query. The following query gives me the right SCFTOTAL but not TOTAL.

SELECT A.AREAID, LEFT(C.ZIP,3) AS SCF, SUM(D.TOTAL) AS TOTAL, SUM(E.TOTAL) AS SCFTOTAL
FROM AREAORDER A JOIN ZIPCROSS C ON A.AREAID=C.AREAID
JOIN HOUSEHOLDDATA D ON C.ZIP=D.ZIP
JOIN HOUSEHOLDDATA E ON LEFT(C.ZIP,3)=LEFT(E.ZIP,3)
WHERE A.MAILINGORDERID=133
GROUP BY A.AREAID, LEFT(C.ZIP,3)
ORDER BY A.AREAID, SCF

I'm aware of why this doesn't work but I can't seem to find the right approach. Any solutions? TIA.

View 1 Replies View Related

Using Double-Take With SQL 2000 Sp4

Feb 21, 2007

I am experiencing issues with database files that have been moved using double take. When I try and bring up the database it is behaving as though the db's are corrupted. Bottom line is that it is not working. Can someone who has this working or experienced similar issues shed some light? Thanks in advance.

View 1 Replies View Related

Help On Filtering Double Id

May 26, 2008

Hi everybody..

have this table and I want to filter only those records that has it's id's appearing more than one.


table

id field1

1 ! first
1 ! second
2 ! first
3 ! first
3 ! second
4 ! first

the result should be

id field1

1 ! first
1 ! second
3 ! first
3 ! second

am using this query

select field1, id, count(id) as countid
FROM table1
GROUP BY field1
HAVING count(id) >1

the countid column gives me always the value of one (don't know the reason) so I couldn't get the results I want

thanks

View 4 Replies View Related

Convert To Double

Mar 22, 2007

Hi all. How to convert a 1.000000000 to 1.00?

sample...
select amount from .....

Thanks
-Ron-

View 1 Replies View Related

Double Summation

Oct 9, 2006

I have some data -- counts ID'd by location and grid East like this --Loc East NCA 100 3CA 103 5CA 109 2CA 110 3I'm interested in the total of N on either side of the largest gap inEastings.In this case the largest gap is 6 (between 103 and 109), and the sum ofN for the 2 rows below the gap is 8, and for the 2 above the gap it's5.The problem is to locate the largest gap, and compute the sum of N forthe cases on either side. There are multiple locations, multipleEastingsper location, but only one largest gap. (If there are two largestgaps, itdoes't matter which one is used for the sums.)I can do this with multiple passes -- first locate the largest gap,then goback and locate the Eastings on either side, then sum up the Ns.That'srealy clumsy, I can't figure out how to do it more quickly, and I'm notsurewhat I'm doing is right. Any help would be appreciated.Thanks,Jim Geissman

View 2 Replies View Related

Remove Double Value

Jul 20, 2005

HyNever use/practice SQL a lot, (vb... more, have free msde 2000) .2 questionsA)is it simple to write a T-SQL query for having 2) at result startingfrom 1) .B)how to test dynamically sql with parmaeter ( using vb ADO)1) before querycolumA columBd e <-samee d <-samee ee d <-same2)after querycolumA columBd e or e de e

View 2 Replies View Related

Double Quotes

Jul 25, 2007

Hi,
I am creating a flat file connection to a .csv file
In the columns section of the flatt file connection manager editor, I am not sure why the texts in the .csv file are shown with double quotes arouond them.
They do not have "" in the .csv file.
Thanks

View 1 Replies View Related

Decimal And Double

Sep 27, 2007

what is the exact difference between double and decimal data type? with example

View 1 Replies View Related

SQL Server Double Hop

Feb 25, 2008

I have run into a somewhat pain in the posterior situation.

We have an app that currently uses SQL Server authentication. The application also uses a linked server. Now, we would like to move to a Windows authentication type of set up, but from what my network guys tell me is that AD doesn't support a "double hop".

In reading what's out here, I'm getting the impression that Kerberos needs to be enabled or delegation?

Does anyone know of somewhere I can find some good instructions on how to configure my SQL Server(s) to support the double hop?

I guess I shouls also tell ya whay our set up is:

- Our users authenticate onto our network.
- They then authenticate into Citrix.
- From Citrix they authenticate into SQL Server.
- Then there's the linked server.

So essnetially the hops woulg look like this:

Citrix to Database1 is HOP 1
Database1 to Database2 is HOP2

Thanks!!

View 4 Replies View Related

How To Eliminate Double Row

Feb 8, 2008



'My table' is below with double row

lot value date

2 300 3/2/06
3 200 6/5/05
4 100 5/21/07
5 340 6/23/06
2 250 4/3/06

My query such as
SELECT lot, value, date
FROM my table

How can I eliminate 1 row of lot 2 and chose the recent date only?

Thanks for your help
Daniel

View 3 Replies View Related

Double Sided?

Feb 14, 2007

Hi,

I am using SQL Reporting Services 2000 - is it possible to make a report that prints double sided?

View 2 Replies View Related

Double Table Insert

May 12, 2004

Tables :

EmailUsers
ID int - PK
Email nvarchar(256)

ListsUsers
ListID int - FK to List Table - Combo PK
UserID int - FK to EmailUsers Table - Combo PK

When a person adds a user I need to:
A. insert them as a new entry into EmailUsers - no problem
B. insert their EmailUsers.ID from step A and ListID (passed in parameter) into ListsUsers - not so easy
C. if they're already in EmailUsers don't insert them but pass their existing EmailUsers.ID to part B

Any thoughts or examples I can follow? Maybe it's easier to do two seperate queries and control the if exists logic in asp.net?

View 9 Replies View Related

Double-byte In MSSQL

May 22, 2001

Experts,

i have trouble while insert/update a field which contains double-byte characters (Chinese Traditional).

NO PROBLEM if i m using Enterprise Manager to view/edit the data. They are retrieved properly in the following:
(1) Enterprise Manager
(2) Query Analyzer
(3) Visual Basic
(4) Command prompt isql

EACH of the Chinese words are become a qustion mark '?' if the UPDATE SQL or stored procedure executed in the following:
(2) Query Analyzer
(3) Visual Basic

WHILE (4) Command prompt isql does not have the problem for the same UPDATE SQL and stored procedure.

Do you have any idea?

View 1 Replies View Related

Double Data Type??

Jan 16, 2003

What data type in SQL server can be used in place of a double data type?? I don't even know what a double data type is but got a request to create a column with a data type of double.

Thanks.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved