Adding Values To A Parameter That Can Take Multiple Values

Jun 6, 2007

If I have a Select statement like this in my C# code:

Select * From foods Where foodgroup In (@foodgroup)

And I want @foodgroup to have these values ... "meat", "dairy", fruit", what is the correct way to add the parameter?

I tried

meat, dairy, fruit

'meat', 'dairy', 'fruit'

but neither worked. Is this possible?

View 2 Replies


ADVERTISEMENT

Adding Multiple Values Into A Row/column Help

Mar 6, 2004

Whats the fastest easiest way to take a select that returns say 4 values for the expression into a single column on defined row

basically I mean i want to do an update to say a persons i dunno ummm places they have traveled and I want it listed like france;usa;germany etc etc and the data would always be in the tables i pull from so I can overwrite the data each time i run it but has to take 3 or more values from a query and put them in separated by say a ; into the same persons coloumn that stores the info.

I did this once before with a cursor and adding a variable to itself with colasce or whatever the command was, but was just wondering if there is a fast way to do this by chance that im not thinking about :P.

Thanks!

View 3 Replies View Related

Need Help Adding Multiple Values To Dropdownlists Datatextfield

Jan 15, 2004

I'm trying to put a range of dates into the datatextfield of my ddl. I'm using the query:

string strProps2 = "SELECT sc_id, cast(begin_date AS varchar) + ' - ' + cast(end_date AS varchar) AS XYZ From Archived_Property_Changes WHERE Property_number = " + qryPN + " ORDER BY end_date";

but it gives me an empty ddl. the datavaluefield shows the correct results, but it's not displaying the correct data from the datatextfield. I removed the casts from the SQL query and it returns:

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value

Below is my ddl code:

SqlCommand objCommandProps2 = new SqlCommand(strProps2, myConnection);
SqlDataReader objReaderProps2 = objCommandProps2.ExecuteReader();

ddlArchive.DataSource = objReaderProps2;
ddlArchive.DataValueField = "sc_id";
ddlArchive.DataTextField = "XYZ";
ddlArchive.DataBind();
ddlArchive.Items.Insert(0, "Select A Period");

Any thoughts are duely appreciated...

View 2 Replies View Related

Multiple Values Of A Parameter

Feb 8, 2008

I have some 5 parameters which I've specified as multi-valued and my report uses a stored procedure. When I select all values in my dropdown (parameters) within my reports nothing shows up. How can I pass multiple values of a parameter into my stored procedure such that it works?

View 4 Replies View Related

Parameter Label With Multiple Values

Oct 22, 2007

Hi,

I have a parameter "country" that currently has something like 50 labels (each with a different value) for different countries. I want to be able to design this so that I can select US, Canada and World. This requires me to put multiple values under the "World" label.

Is this doable in reporting services?

Thanks in advance,
Steven

View 3 Replies View Related

SQL Report With Parameter For Multiple Values

Apr 20, 2007

I need to somehow set up a third parameter which allows me to control the tag quantity type either by ALL - % , IS NULL, or IS NOT NULL.



I tried TAG_QUANTITY LIKE :Tags but this would only work if I had the % option select and not the IS NULL or IS NOT NULL



Any thoughts on how to format the select statement?





SELECT ORGANIZATION_ID, TAG_ID, PHYSICAL_INVENTORY_ID, TAG_NUMBER, CREATION_DATE, VOID_FLAG, TAG_QUANTITY, TAG_UOM, SUBINVENTORY,
LOCATOR_ID, COUNTED_BY_EMPLOYEE_ID
FROM INV.MTL_PHYSICAL_INVENTORY_TAGS
WHERE (ORGANIZATION_ID = ite) AND (PHYSICAL_INVENTORY_ID = :InventoryID) AND (VOID_FLAG = 2) AND TAG_QUANTITY IS NULL
ORDER BY TAG_NUMBER

View 1 Replies View Related

Parameter Setup: One Label Multiple Values --- Can This Be Done?

Mar 12, 2008



I reviewed many threads and looked through many pages in my book, I cannot find my answer.

I have a report in need of carrying multiple values per parameter label. Here is the report parameter and how it is used;

Our IS system considers A-Active, L-On Leave, P-Paid Leave to be "Active"
Our IS system considers T-Terminated, D-Deceased to be "Termed"

Instead of having to have the user click upon three options (A, L, P), I would like to group these and have the Label appear as "Active", while the two options for "Termed" (D, T), would appear as the second parameter option.

Does anyone know how I would get this correctly setup in the Report Parameters... module?

I have tried

Label|Value
Active|A,L,P
Termed|D,T

And

Label|Value
Active|(A,L,P)
Termed|(D,T)

Thank you,


Mark

View 3 Replies View Related

Analysis :: Default Multiple Values For A Parameter

Nov 5, 2015

I am trying to select some values as default for a parameter, I add my data set,add my parameter then I  select the values in the default pane, when I run the report I get :

'the default value expression for the query parameter contains an error[BC30451] name is not declared.

When I look at the expression of the default parameter (in the report data pane under the specify values) it appears like

=new Object() {[Sty].[ST].&[1], [Sty].[ST]..&[15]}
with a red scrible under the () 

View 9 Replies View Related

How To Pass Multiple Values To A Parameter While Cascading

Oct 9, 2006

Hi,

I am using RS2005. i have a requirement in which i need to pass more than 1 value to a parameter. this parameter is used in a dataset for filtering.

Eg: if i have a parameter as @years, i want to assign values 2005, 2006 to it and use it in the dataset to filter like select.... where year in (@years).

How can i achieve this?

Thanks

Vivek S

View 13 Replies View Related

How Do I Enter In A Default Values For A Report Parameter That Accepts Multi Values

Apr 11, 2008



I have my stored procedure set to
Territory_code IN (@Territory)

, now , how do i enter in more then one value. When i select the multi value check box, it gives me more spaces. But then doesnt recognize the values when i put in more then one. am i doing something wrong?

The field is a Varchar 20

View 1 Replies View Related

T-SQL (SS2K8) :: Insert Multiple Values Based On Parameter

Jul 22, 2014

I need to write SP where user select SUN to MON check boxes. If user select Class A with sun,mon and wed check boxes then i need to insert data as below

CLASS Days
A sun
A Mon
A wed

View 6 Replies View Related

SQL Server 2014 :: Linking Parameter To Multiple Values

Feb 17, 2015

Attempting to build a report were you can place a specific code in the parameter field and it will return all row values based on that particular code. I have a similar report that works great, but the specific code is just in 1 column, the one I'm trying to create has the potential to have that code in up to 20 different spots. I have the report built, but the issue I'm facing is linking the parameter. Is there a way to link 1 parameter to multiple column options?

Here's an example:

Docflo Distribution Group Queue Status Pend1 Pend 2 Pend 3 Pend 4 Pend 5
ABC ABC1 Catch All NEW 123 126 125 621 129
ABC ABC1 Various PENDED 621 123 872 542 630

Right now if I were to link the parameter to the Pend1 field, I would get every line I wanted that had Pend "123", but it would not include any of the lines where Pend "123" was in Pend 2, Pend 3, Pend 4, so on.

How would I link the parameter to more than 1 column so it would return all rows with a specific code no matter which Pend column it was in?

View 9 Replies View Related

Transact SQL :: How To Pass Multiple Values Into A Single Parameter

Jun 1, 2015

Below is the query for my procedure 

ALTER PROC [dbo].[sp_GetInvitationStatusTest]
(
@invited_by NVARCHAR (50)
)
AS
BEGIN
-- SELECT * FROM dbo.Merck_Acronym_Invitations WHERE invited_by=@invited_by
select distinct t1.invited_isid as 'ISID', t1.invited_name as 'NAME',t1.invitation_status as 'STATUS',

[Code] ....

If you look at the where clause i have invited by , i get the desired output if i just provide 1 name in the execution such as exec [dbo].[sp_GetInvitationStatusTest] 'marfilj' But my requirement is to make the procedure work with more than one input variable such as exec [dbo].[sp_GetInvitationStatusTest] 'marfilj','sujith' now i should get the output for 2 people but if i run this i receive the following error Procedure or function sp_GetInvitationStatusTest has too many arguments specified.

how to make my procedure work with more than 1 input variable?

View 4 Replies View Related

Transact SQL :: How To Make Procedure Work For Multiple Values In Parameter

Jun 7, 2015

Below is the stored procedure i have it works fine if i have 1 value passed to @invited_by but i want to modify but i want this code to be working for multiple inputs .Lets say if i do

exec [dbo].[sp_GetInvitationStatusTest] 'Test1 . I get the desired output but i want this procedure to work for
exec [dbo].[sp_GetInvitationStatusTest] 'Test1,Test2'.
USE [merck_acronyms]
GO

[code]....

View 2 Replies View Related

Passing Multiple String Values Separted By A Comma As One Parameter

Oct 16, 2007



Hello,



I have a stored procedure that accepts one parameter called @SemesterParam. I can pass one string value such as €˜Fall2007€™ but what if I have multiple values separated by a comma such as 'Fall2007','Fall2006','Fall2005'. I still would like to include those multiple values in the @SemesterParam parameter. I would be curious to hear from some more experienced developers how to deal with this since I am sure someone had to that before.



Thanks a lot for any feedback!

View 6 Replies View Related

Reporting Services :: Selecting Multiple Parameters Values For Comma Separated Values In SSRS?

Jun 17, 2012

I am SSRS user, We have a .net UI from where we want to pass multi select values, but these values are comma separated in the database. how can I write a sql query such that when I select multi values on my UI, the comma separated values are take care of.

View 5 Replies View Related

SQL Server 2008 :: Table Valued Function Where Parameter Has Multiple Values

Jan 29, 2015

Is it possible to pass multiple values to a TVF, such as using an IN clause?

View 6 Replies View Related

Reporting Services :: Selecting Data Using One Parameter With Multiple Text Values

Oct 9, 2015

I am using SSRS 2008 R2 Report Builder 3.0 (10.50.4276.0) . I have simple set of data which has a persons Title and Name e.g. Mr Smith, Miss Jones, Doctor Foster

The report has a parameter where the user can select which records to show based on the matching titles (Mr, Miss, Doctor)

The Query for the report uses Title in (@Title) where @Title is the only parameter which can take multiple values. The report works correctly for any 1 value selected, but as soon as 2 or more values are ticked in the drop down, it fails.

I believe the parameter value is being passed into the query with a comma separating the values e.g. Mr,Miss which causes the IN statement to give an error, as the statement would be where Title IN ('Mr,Miss') which does not match any of the data values.

The parameter value passed needs to be 'Mr','Miss' for the IN statement to work. What statement do I have to put in the report query to get it to select any of the data rows where the title matches any 1 of the selected values?

View 5 Replies View Related

Accessing Values Parameter Values From Another Report

Sep 20, 2007

Hi, How can I display a value of a report parameter from one report into a textbox on another report??

View 1 Replies View Related

Reporting Services :: How To Filter MDX Query Using SSRS Report Parameter With Multiple Values

Oct 14, 2009

I am creating a SSRS report using a SSAS cube as it data source.  The user would like to select multiple values from a reporting parameter that is then used as a filter on the MDX statement.  I am bale to have the report work successfully when only one value is selected but not when multiple values are selected; the report uses only the first value from the reporting parameter when it contains multiple values.  How do I filter an MDX query using a SSRS report parameter with multiple values?

View 3 Replies View Related

'Insert Into' For Multiple Values Given A Table Into Which The Values Need To Go

Sep 1, 2007

Please be easy on me...I haven't touched SQL for a year. Why given;



Code Snippet
USE [Patients]
GO
/****** Object: Table [dbo].[Patients] Script Date: 08/31/2007 22:09:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Patients](
[PID] [int] IDENTITY(1,1) NOT NULL,
[ID] [varchar](50) NULL,
[FirstName] [nvarchar](50) NULL,
[LastName] [nvarchar](50) NULL,
[DOB] [datetime] NULL,
CONSTRAINT [PK_Patients] PRIMARY KEY CLUSTERED
(
[PID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF


do I get

Msg 102, Level 15, State 1, Line 3

Incorrect syntax near ','.
for the following;




Code Snippet
INSERT INTO Patients
(ID, FirstName,LastName,DOB) VALUES
( '1234-12', 'Joe','Smith','3/1/1960'),
( '5432-30','Bob','Jones','3/1/1960');


Thank you,
hazz

View 3 Replies View Related

Integration Services :: Pass Multiple Parameter Values To SSIS Package In 2012 Through Stored Procedure?

Jul 9, 2015

we can  assign one parameter value for each excecution of  [SSISDB].[catalog].[set_object_parameter_value] by calling this catalog procedure..

Example: If I have 5 parameters in SSIS package ,to assign a value to those 5 parameters at run time should I call this [SSISDB].[catalog].[set_object_parameter_value] procedure 5 times ? or is there a way we can pass all the 5 parameters at 1 time .

1. Wondering if there is a way to pass multiple parameters in a single execution (for instance to pass XML string values ??)
2.What are the options to pass multiple parameter values to ssis package through stored procedure.?

View 4 Replies View Related

Compressing Multiple Rows With Null Values To One Row With Out Null Values After A Pivot Transform

Jan 25, 2008

I have a pivot transform that pivots a batch type. After the pivot, each batch type has its own row with null values for the other batch types that were pivoted. I want to group two fields and max() the remaining batch types so that the multiple rows are displayed on one row. I tried using the aggregate transform, but since the batch type field is a string, the max() function fails in the package. Is there another transform or can I use the aggragate transform another way so that the max() will work on a string?

-- Ryan

View 7 Replies View Related

Transact SQL :: Update One Table Based On Another Table Values For Multiple Values

Apr 26, 2015

I have two tables  A(uname,address,full_name) and B(uname,full_name). I want to update table A for all matching case of uname in table B. 

View 5 Replies View Related

Transact SQL :: Converting From Multiple Rows With Single Values To Single Rows With Multiple Values

May 10, 2015

Here is some data that will explain what I want to do:

Input Data:
Part ColorCode
A100 123
A100 456
A100 789
B100 456
C100 123
C100 456

Output Data:
Part ColorCode
A100 123;456;789
B100 456
C100 123;456

View 4 Replies View Related

Adding Up Values

Apr 5, 2007

I have 21 Boolean fields that I would like to calculate a percentage from. If the boolean value is true I would like to be able to return a percentage of Outcomes available from a possible of 21. So If 7 of my boolean fileds are true then i would like to be able to calculate that 33% of Outcomes are present.

Does anyone have anything that will get me started?

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Client]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Client]
GO

CREATE TABLE [dbo].[Client] (
[RecordID] [int] IDENTITY (1, 1) NOT NULL ,
[FacilityNumber] [int] NOT NULL ,
[AdmitNumber] [int] NOT NULL ,
[LastName] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[FirstName] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[MiddleName] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Suffix] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[BirthDate] [datetime] NULL ,
[AdmitDate] [datetime] NULL ,
[AdmitWeight] [real] NULL ,
[IdealWeightLow] [real] NULL ,
[IdealWeightHigh] [real] NULL ,
[Unit] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Bed] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[MedicaidNumber] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[GuardianName] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[GuardianAddress1] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[GuardianAddress2] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[GuardianCity] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Outcomeb01] [bit] NULL ,
[Outcomeb02] [bit] NULL ,
[Outcomeb03] [bit] NULL ,
[Outcomeb04] [bit] NULL ,
[Outcomeb05] [bit] NULL ,
[Outcomeb06] [bit] NULL ,
[Outcomeb07] [bit] NULL ,
[Outcomeb08] [bit] NULL ,
[Outcomeb09] [bit] NULL ,
[Outcomeb10] [bit] NULL ,
[Outcomeb11] [bit] NULL ,
[Outcomeb12] [bit] NULL ,
[Outcomeb13] [bit] NULL ,
[Outcomeb14] [bit] NULL ,
[Outcomeb15] [bit] NULL ,
[Outcomeb16] [bit] NULL ,
[Outcomeb17] [bit] NULL ,
[Outcomeb18] [bit] NULL ,
[Outcomeb19] [bit] NULL ,
[Outcomeb20] [bit] NULL ,
[Outcomeb21] [bit] NULL ,
[GuardianState] [nvarchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Outcomea21] [bit] NULL ,
[Outcomea20] [bit] NULL ,
[Outcomea19] [bit] NULL ,
[Outcomea18] [bit] NULL ,
[Outcomea17] [bit] NULL ,
[Outcomea16] [bit] NULL ,
[Outcomea15] [bit] NULL ,
[Outcomea14] [bit] NULL ,
[Outcomea13] [bit] NULL ,
[Outcomea12] [bit] NULL ,
[Outcomea11] [bit] NULL ,
[Outcomea10] [bit] NULL ,
[Outcomea09] [bit] NULL ,
[Outcomea08] [bit] NULL ,
[Outcomea07] [bit] NULL ,
[Outcomea06] [bit] NULL ,
[GuardianZipCode] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Outcomea05] [bit] NULL ,
[Outcomea04] [bit] NULL ,
[Outcomea03] [bit] NULL ,
[Outcomea02] [bit] NULL ,
[Outcomea01] [bit] NULL ,
[GuardianPhoneNumber] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[SSN] [nvarchar] (12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Gender] [nvarchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Race] [nvarchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[AdmittingDiagnosis] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CurrentDiagnosis] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Active] [bit] NULL ,
[CAPMRDDWaiverServices] [bit] NULL ,
[upsize_ts] [timestamp] NULL ,
[EventTriggerCount] [int] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[Client] ADD
CONSTRAINT [DF__Client__Facility__117F9D94] DEFAULT (0) FOR [FacilityNumber],
CONSTRAINT [DF_Client_AdmitNumber] DEFAULT (0) FOR [AdmitNumber],
CONSTRAINT [DF__Client__AdmitWei__1367E606] DEFAULT (0) FOR [AdmitWeight],
CONSTRAINT [DF__Client__IdealWei__145C0A3F] DEFAULT (0) FOR [IdealWeightLow],
CONSTRAINT [DF__Client__IdealWei__15502E78] DEFAULT (0) FOR [IdealWeightHigh],
CONSTRAINT [DF__Client__CAPMRDDW__164452B1] DEFAULT (0) FOR [CAPMRDDWaiverServices],
CONSTRAINT [aaaaaClient_PK] PRIMARY KEY NONCLUSTERED
(
[RecordID]
) ON [PRIMARY]
GO

View 2 Replies View Related

How To Use Default Parameter Values With A Date Parameter From A Cube/Reducing Parameters

Oct 15, 2007



Hi,

I have parameters in my report. The user can choose the year, month and date (3 parameters).
Now I want to set default vaules for the parameters , so that the user sees the report for example for the current day without selecting the parameters. I tried to set the type of the parameters to DateTime and the default value for example for the year to "=Today().Year" . But when I execute the report an error occures . Something like : no validValue for this parameter.

My Attributes for the year month and date are from an Analyis Services Cube from a Server Time dimension .
Does somebody know how to make it possible to set default values for this parameters?



Other question :

Does somebody know how I can reduce the values for a parameter. For Example I have a parameter "year" from a server time dimension from a cube. The values which are available are "Year 2004", "Year 2005", "Year 2006", "Year 2007".
But I want that the user only can choose "Year 2006" or "Year 2007" ant not every Year or "All".
Or Other Example: The User should only choose a Date that is int the past or Today but not a Date in the future.


Thanks !

JF

View 7 Replies View Related

Is It Possible To Dynamically Populate A Parameter List With Values Based On Another Parameter Value?

Aug 11, 2005

Is it possible to fill a parameter list with values based on another parameter value?
Here's what I have so far (which hasn't worked)...
I'd like to generate a report listing information for a student.  The report viewer would first select a school from the first drop-down menu, and then the second drop-down menu would populate with the list of students at that school.
I have a dataset that calls a sp which returns a list of schools (SchoolID and SchoolName fields from the database table).
I have another dataset that calls a sp (with SchoolID as the parameter) which returns a list of students for that school.
Both datasets return the appropriate data when tested individually, but when I set up the Report Parameters and build the report, these errors come up...
The value expression for the query parameter '@SchoolID' refers to a non-existing report parameter 'SchoolID'.
The report parameter 'Student' has a DefaultValue or a ValidValue that depends on the report parameter "SchoolID".  Forward dependencies are not valid.
...Is it possible for the reoprt to generate a list of available parameter values based on the value selected for another parameter?
Any help you can give me would be great!!  Thank you

View 5 Replies View Related

Adding Sql Values From 2 Tables

Feb 15, 2007

Hello all, i have 2 sql tables, and they each contain a column with bigint values. What i want to do is add up the values from both table, and then display it as 1 number. Supposing i have the following
table name: DownloadTable
fileName | DownloadSize |
file1       | 45
file2       | 50
file3       | 20
---------------------------------------------
 second table
table name: VideoTable
fileName | VideoSize |
file1       | 40
file2       | 60
file3       | 20
----------------------------------------
Now, i want this to output 120, wich is the sum of the sum of the values of table 1 and 2 I've already tried the following:
SELECT SUM(DownloadTable.DownloadSize) + SUM(VideoTable.VideoSize) FROM DownloadTable, VideoTable
However, when i ran this, it gave me a huge number, that was far from accurate from what it was suppose to output. Can anyone help me?
Thanks in advance
Regards,

View 8 Replies View Related

Adding Values In Database

Apr 15, 2008

Hi guys, I need some help again please.
On my page load, I need the following done...
I have a label control that must display a certain numeric value. This value must be the sum of an array of values that must be retreived from a table ("Details") with the column name "DealValue" but only where the column "ConsultantID" = txtConsultant.text
I understand the select statement, but I don't know how to "run" through the table to add all the values. Can someone please help me with this and how I would construct the MSSql select statement for this.
Thanks again

View 4 Replies View Related

Adding All Values In One Column

Oct 13, 2005

I posed this problem a few days ago, but havent been able to generate the results i need. Suppose my resultset from an sql query gathering totalsales for a given day by a salesrep looks like this:Lastname      totalsales  orderID-----------------------doe               1403         510doe                500          680 doe                 200          701using SUM(Accounts.totalsales) is not adding up the totalsales. What do I need to do to add up the totalsales, and then reassign it to a newfield?netsports

View 8 Replies View Related

Adding Values With Null

Jul 8, 2002

Hi,

I want to perform the following select statement

select (sum(ColA) + sum(ColB) + sum(ColC)) / 3
from tableA
Where ....


I want to add the sum of the columns and then divide it by a constant. The problem I am having is there are a lot of nulls in the database that I am working on (i.e. one of the values in the ColB is Null, which makes the result of the entire expession null).

How do I get around this. I need to add the values of the columns?

Any help would be appreciated.

Thanks,

Bill

View 3 Replies View Related

Adding Values To Columns

Jan 17, 2012

I have a table with 6 columns. which we can call a, b, c, d, e, f. What I want to achieve is to put data in column d and e and then split this result in column f.

The data I want to put in column d and e is already exported and executed from a table called exp_data, which is from a period of november.

So this is what i have so far but is not working:

update split_table set d =
select amount from exp_data
where period = '1111'
and exp_data.account = split_table.b
and exp_data.company = split_table.a

The error I get is incorrect syntax near select. Fixed the issue by adding a parenthesis before the select until the end...

View 6 Replies View Related







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