SQL Code To Display Item

Jun 5, 2007

Is there any SQL code which displays one item if there is mutiple entry of same item. For example: in one columan I have many entry of one item, but I want to display only one item and also I want to display other column as well connecting with that item number.

View 10 Replies


ADVERTISEMENT

Help In Auto Generating Item Code

Aug 28, 2007

Hi guys,

I am new to programming and sqlserver 2000. i use sql2000 as my database server...

I have a problem on auto-generating medicine codes. and i hope someone would help me with my script.

as you noticed i declared two variables (@id and @code). I am having a problem in generating @code... i would just like to create an autogenerated medicines_code from another field from another table (hosp_counter.counter_id)

here is how my medicines_code should look like ('MEDS34') "where 34 is from a counter_id in hosp_counter table...

but it only creates a medicines_code = 'M' (below is the result)

34(this is from counter_id)M(this is the autogenerated code)AUTOGENERATE11111010110012110010000000018/29/2007 11:29:46 AM1/1/19001/1/1900

here is my script in autogenerating medicine code...

set xact_abort on
begin transaction
declare @Code as varchar
select @Code =
(select 'MEDS' + CAST
(Counter_ID + 1 as varchar (50))
from Hosp_Counter where table_description = 'Medicines')
declare @ID as integer
select @ID = Counter_ID + 1
from Hosp_Counter
where table_description = 'Medicines'
select @ID
INSERT INTO Hosp_Medicines
(medicines_id,
medicines_code,
medicines_description,
medicines_specification,
medicines_genericname,
medicines_drugclass,
PhicCategory,
medpreparation,
medicines_prohibited,
medicines_trade,
medicines_NoneTrade,
medicines_taxable,
medicines_PhicCovered,
medicines_AmountCovered,
medicines_Discountable,
medicines_SmallUnit,
medicines_BigUnit,
medicines_AverageCostSmall,
medicines_AverageCostBig,
medicines_WeightedAverageCost,
medicines_weight,
medicines_conversion,
medicines_LowStockLevel,
medicines_OverStockLevel,
medicines_LowSalesReference,
AllowStat,
status,
CreateBy,
UpdateBy,
DeleteBy,
CreateDate,
UpdateDate,
DeleteDate)
VALUES
(@ID,
@code,
'AUTOGENERATE2',
'',
1,
1,
1,
1,
0,
1,
0,
1,
1,
0,
0,
1,
2,
1,
100,
100,
0,
0,
0,
0,
0,
0,
1,
'',
'',
'',
'8/29/2007 11:31:25 AM',
'',
'')
select @ID
Update Hosp_Counter set Counter_ID = @ID
where Table_Description = 'Medicines'
commit transaction

any help is very much appreciated!

'confused'
Joel

View 3 Replies View Related

Getting The Foreground,Background Colors In The Report Item Dynamically Using Custom Code

Oct 25, 2007



Hi All,
I want to get the Font,Background colors of the report item(Textbox) changed in Runtime,According to the value in the Textbox. The idea is to get this done by using the Same Custom code for getting both the Foreground,Background colors, I thought to implement this with flag, But I dont know how to do this..

Reporting experts ..please help me with this issue.Thanks in Advance

-Mahendra

View 2 Replies View Related

Create A Query Where Semi Item Materials Are Also Listed In Finished Item Recipe?

Dec 6, 2013

I have a BOM table with all finished item receipes and semi items recipes. create a query where semi item materials are also listed in finished item recipe.

View 5 Replies View Related

Transact-sql Code To Display Preformatted Tables

Mar 3, 2006

altimebest1 writes "Please show sql codes to creating a table showing Value and quantity under a heading, the month the data was collected or the value and quantity in the 1st, 2nd, 3rd and 4th quarter values under a heading Year.
My source table is:
comCode char 7
monthCode char 2
year char 4
countryCode char 3
quantity int
value money
insurance money
freight money
i also have a lookup table for:


Commodities Countries
comCode char 7 countryCode char 3
comDescriptions varchar 255 countryName varchar 255


the format of the table i wish to create

Com Commodity Description Jan
Code Country of Destination ValueQuantity


Thank you for helping me and I been a constant visitor to your site and it's wonderful and gives great help to sql enthusiasts."

View 1 Replies View Related

Help, Running A Control Flow Item Does Not Kick Off The Next Item

Mar 6, 2007

Hi,

Here's my problem. I have 2 tasks defined in my Control Flow tab:

EXECUTE SQL--------->EXECUTE DTS 2000 PACKAGE

When I attempt to run it, by right-clicking the EXECUTE SQL task, and selecting "Execute Task", it only runs the EXECUTE SQL part (successfully), and does not "kick off" the EXECUTE DTS 2000 PACKAGE, after it is done running (even though it completes successfully, as shown by the green box).

Yes, they are connected by a dark green arrow, as indicated in my diagram above.

Why is this?? Am I missing something here? Need help.

THANKS

View 3 Replies View Related

How To Select The Last Identical Item# Until A Different Item# In The Table

Jul 12, 2007

Hello,Basically, I have a table with 2 fieldsId     item#1      33332      33333      22224      22225      22226      33337      33338      3333I would like to only select the last identical Item# which in this case would be  the id 6,7 and 8Any idea how could I do that?Thanks

View 1 Replies View Related

How Can I Create A New Custom Report Item? The Report Item Is Extends Matrix.

Jan 18, 2007

hi everyone

what the matrix's class name ?

where is the matrix's dll?

Can i create a new class extends the matrix?

I want to override the matrix's onpaint method.

Can i do this ?

why the table not have the column group?













View 9 Replies View Related

Finding Orders That Have At Least 1 Promo Item And 1 Non-promo Item

Oct 16, 2014

I am having trouble finishing the last bit of a report. The report shows orders that customers have placed that contain 0 promo items, All promo items (all items in order are promo items), and a mix of promo and non promo (at least 1 promo item and 1 non-promo item). Ive simplified this a bit for ease of understanding but lets assume we have 2 tables: A Promo table that contains the items on promotion and the dates that promotion is valid, and a Sales table, that contains the order number, order date, and sku ordered.

I've already written code that finds orders that have at least 1 promo item in them, and using that, I can determine what orders have 0 promo items in them. Where I am stuck is taking the orders that have at least 1 promo item in them, and separating them into orders that have only promo items, and those that have both promo and not promo items in them. Also, there are several promos throughout the year (called "Offers") so in my code below, you can see 2 different Offers ("JF" and "MA") with their corresponding dates they are valid. They will never overlap. My results also have to be split out by Offer so management can look at the results of each offer separately. Here is some code:

Code:
create table #Promos (
Offer varchar(2) null,
SKU int null,
StartDt date null,
EndDt date null

[Code] ....

So my results should show OrderNo A1111 in the Promo and No Promo group because of SKU 5 not being promotional during the time that order was placed. OrderNo A2222 should be in the Promo Only group because both SKUs on the order were promotional at the time the order was placed.

View 6 Replies View Related

Reporting Services :: Display Columns When There Is No Data To Display

Apr 30, 2015

I would like to display a portion of report where there is data or no data

There is data subreport  display   

     Product Name Latex Gloves  
     Product ID      
xxxx5678

 There NO data in the subReport
 
  Product Name                          
   Product ID    

View 3 Replies View Related

Help With Converting Code: VB Code In SQL Server 2000-&&>Visual Studio BI 2005

Jul 27, 2006

Hi all--I'm trying to convert a function which I inherited from a SQL Server 2000 DTS package to something usable in an SSIS package in SQL Server 2005. Given the original code here:
Function Main()
on error resume next
dim cn, i, rs, sSQL
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
set rs = DTSGlobalVariables("SQLstring").value

for i = 1 to rs.RecordCount
sSQL = rs.Fields(0).value
cn.Execute sSQL, , 128 'adExecuteNoRecords option for faster execution
rs.MoveNext
Next

Main = DTSTaskExecResult_Success

End Function

This code was originally programmed in the SQL Server ActiveX Task type in a DTS package designed to take an open-ended number of SQL statements generated by another task as input, then execute each SQL statement sequentially. Upon this code's success, move on to the next step. (Of course, there was no additional documentation with this code. :-)

Based on other postings, I attempted to push this code into a Visual Studio BI 2005 Script Task with the following change:

public Sub Main()

...

Dts.TaskResult = Dts.Results.Success

End Class

I get the following error when I attempt to compile this:

Error 30209: Option Strict On requires all variable declarations to have an 'As' clause.

I am new to Visual Basic, so I'm on a learning curve here. From what I know of this script:
- The variables here violate the new Option Strict On requirement in VS 2005 to declare what type of object your variable is supposed to use.

- I need to explicitly declare each object, unless I turn off the Option Strict On (which didn't seem recommended, based on what I read).

Given this statement:

dim cn, i, rs, sSQL

I'm looking at "i" as type Integer; rs and sSQL are open-ended arrays, but can't quite figure out how to read the code here:

Set cn = CreateObject("ADODB.Connection")

cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"

set rs = CreateObject("ADODB.Recordset")

This code seems to create an instance of a COM component, then pass provider information and create the recordset being passed in by the previous task, but am not sure whether this syntax is correct for VS 2005 or what data type declaration to make here. Any ideas/help on how to rewrite this code would be greatly appreciated!

View 7 Replies View Related

How To Show Description In Report Instead Of Code (Desc For Code Is In Master Table)

Mar 28, 2007

Dear Friends,



I am having 2 Tables.

Table 1: AddressBook
Fields --> User Name, Address, CountryCode



Table 2: Country
Fields --> Country Code, Country Name


Step 1 : I have created a Cube with these two tables using SSAS.



Step 2 : I have created a report in SSRS showing Address list.

The Column in the report are User Name, Address, Country Name



But I have no idea, how to convert this Country Code to Country name.

I am generating the report using the Layout tab. ( Data | Layout | Preview ) Report1.rdl [Design]



Anyone help me to solve this issue. Because, in our project most of the transaction tables have Code and Code description in master table. I need to convert all code into corresponding description in all my reports.




Thanks in advance.





Regards
Ramakrishnan
Singapore
28 March 2007

View 4 Replies View Related

Item

Jan 12, 2005

I want read
dr[2] = SqlDataReader dr1.item("lastmane");
from database
but I have error expected
I don't while


SqlDataReader dr1 = cmd.ExecuteReader();
dr1.Read();

dr[2] = SqlDataReader dr1.item("lastmane");

View 2 Replies View Related

Need Sum Of A Particular Item

Apr 23, 2008

select i.a,
w.c,
w.e
from table1 i,table2 w where
i.a=w.a (Here c is the primary key for each a)-iam getting o/p like this

a c e

aaa x 2
aaa y 10
bbb y 5
ccc x 3
ccc y 4

i need o/p in this way (ie sum of e for each a)
a e
aaa 12
bbb 5
ccc 7

Is it possible

Thanx

View 1 Replies View Related

Get Item Name Instead Of ID

Jan 11, 2014

I´m trying to get a query where I´ll get an answer like this:

+--------------+----------------+----------------+------------------+-----------------+
| champion_id | champion_name | champion_item1 | champion_item... | champion_item16 |
+--------------+----------------+----------------+------------------+-----------------+
| 1 | Legolas | boots | ... | sword |
+--------------+----------------+----------------+------------------+-----------------+

This is the scenario how I set up my tables (let me know if I should change it):

table champions

+--------------+----------------+
|champion_id | champion_name |
+--------------+----------------+
| 1 | Legolas |
+--------------+----------------+

table equipment

+--------------+----------------+------------------+-----------------+
| champion_id | champion_item1 | champion_item... | champion_item16 |
+--------------+----------------+------------------+-----------------+
| 1 | 5 | ... | 22 |
+--------------+----------------+------------------+-----------------+

table items

+--------------+----------------+
| item_id | item_name |
+--------------+----------------+
| 5 | boots |
+--------------+----------------+
| 22 | sword |
+--------------+----------------+

But I still don´t know how to call the equipment table and get champion name and item names for the numbers. What did I do wrong and how can I fix it?

The foreign keys are in place.

View 5 Replies View Related

Many Lines Of Code In Stored Procedure && Code Behind

Feb 24, 2008

Hello,
I'm using ASP.Net to update a table which include a lot of fields may be around 30 fields, I used stored procedure to update these fields. Unfortunatily I had to use a FormView to handle some TextBoxes and RadioButtonLists which are about 30 web controls.
I 've built and tested my stored procedure, and it worked successfully thru the SQL Builder.The problem I faced that I have to define the variable in the stored procedure and define it again the code behind againALTER PROCEDURE dbo.UpdateItems
(
@eName nvarchar, @ePRN nvarchar, @cID nvarchar, @eCC nvarchar,@sDate nvarchar,@eLOC nvarchar, @eTEL nvarchar, @ePhone nvarchar,
@eMobile nvarchar, @q1 bit, @inMDDmn nvarchar, @inMDDyr nvarchar, @inMDDRetIns nvarchar,
@outMDDmn nvarchar, @outMDDyr nvarchar, @outMDDRetIns nvarchar, @insNo nvarchar,@q2 bit, @qper2 nvarchar, @qplc2 nvarchar, @q3 bit, @qper3 nvarchar, @qplc3 nvarchar,
@q4 bit, @qper4 nvarchar, @pic1 nvarchar, @pic2 nvarchar, @pic3 nvarchar, @esigdt nvarchar, @CCHName nvarchar, @CCHTitle nvarchar, @CCHsigdt nvarchar, @username nvarchar,
@levent nvarchar, @eventdate nvarchar, @eventtime nvarchar
)
AS
UPDATE iTrnsSET eName = @eName, cID = @cID, eCC = @eCC, sDate = @sDate, eLOC = @eLOC, eTel = @eTEL, ePhone = @ePhone, eMobile = @eMobile,
q1 = @q1, inMDDmn = @inMDDmn, inMDDyr = @inMDDyr, inMDDRetIns = @inMDDRetIns, outMDDmn = @outMDDmn,
outMDDyr = @outMDDyr, outMDDRetIns = @outMDDRetIns, insNo = @insNo, q2 = @q2, qper2 = @qper2, qplc2 = @qplc2, q3 = @q3, qper3 = @qper3,
qplc3 = @qplc3, q4 = @q4, qper4 = @qper4, pic1 = @pic1, pic2 = @pic2, pic3 = @pic3, esigdt = @esigdt, CCHName = @CCHName,
CCHTitle = @CCHTitle, CCHsigdt = @CCHsigdt, username = @username, levent = @levent, eventdate = @eventdate, eventtime = @eventtime
WHERE (ePRN = @ePRN)
and the code behind which i have to write will be something like thiscmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@eName", ((TextBox)FormView1.FindControl("TextBox1")).Text);cmd.Parameters.AddWithValue("@ePRN", ((TextBox)FormView1.FindControl("TextBox2")).Text);
cmd.Parameters.AddWithValue("@cID", ((TextBox)FormView1.FindControl("TextBox3")).Text);cmd.Parameters.AddWithValue("@eCC", ((TextBox)FormView1.FindControl("TextBox4")).Text);
((TextBox)FormView1.FindControl("TextBox7")).Text = ((TextBox)FormView1.FindControl("TextBox7")).Text + ((TextBox)FormView1.FindControl("TextBox6")).Text + ((TextBox)FormView1.FindControl("TextBox5")).Text;cmd.Parameters.AddWithValue("@sDate", ((TextBox)FormView1.FindControl("TextBox7")).Text);
cmd.Parameters.AddWithValue("@eLOC", ((TextBox)FormView1.FindControl("TextBox8")).Text);cmd.Parameters.AddWithValue("@eTel", ((TextBox)FormView1.FindControl("TextBox9")).Text);
cmd.Parameters.AddWithValue("@ePhone", ((TextBox)FormView1.FindControl("TextBox10")).Text);
cmd.Parameters.AddWithValue("@eMobile", ((TextBox)FormView1.FindControl("TextBox11")).Text);
So is there any way to do it better than this way ??
Thank you

View 2 Replies View Related

Custom Code (Embedded Code) Question

Oct 16, 2007



Hi all,

Could someone tell me if custom code function can capture the event caused by a user? For example, onclick event on the rendered report?

Also, can custom code function alter the parameters of the report, or refresh the report?

Thanks.

View 2 Replies View Related

How To Get The Last Item Added

Dec 14, 2004

Not 100% sure how to do this so I would appreciate some directions. I have 2 tables, Systems and Contacts. A system can have 1 to infinite contacts and contact can have 1 to infinite systems. So I use a 3rd table Sys_Con to add the contact needed for each system.
Now my question is once I add the System and contact how do I know for sure which ContactID to add in my Sys_Con table? Because while I am doing this operation maybe someone can add an other contact. So is there a way for my store proc Add_Contact to return the contactID needed for my store proc Add_Sys_Con ?

TABLE Sys_Con
SystemID int
ContactID int

Table Contact
ContactID int Identity
ContactName
...

Table System
SystemID
...

View 3 Replies View Related

Get Only ONE Row Per Item With Different Fields

Nov 25, 2007

Hi,

I'm a bit stuck here.
I have a table called STM_COMM and it contains following fields: id, member_id, email_addr, tel_nr, fax_nr

A member can have multiple email addresses, telephone numbers and faxnumbers. so we could have something like this:

id member_id email_addr tel_nr fax_nr
-------------------------------------------------------
1 5 info@test.com
2 5 555687 568774
3 66 test@go.nl 65897854
4 5 another@one.com

What I would like to have is only ONE (1) row PER member with only the FIRST (not max!) entered known data. In the above case, I'd like to have this as result:

member_id email_addr tel_nr fax_nr
----------------------------------------------------
5 info@test.com 555687 568774
66 test@go.nl 65897854

I've tried lots of things (max, inner select ...) but I can't seem to figure it out.

Thank you for the help !

Christophe

PS: I'm working on a sql server 2005

View 1 Replies View Related

Get Value Of Last Item In Column?

Mar 7, 2007

How can I get the value of the last Item in a coums?SELECT COLUMN FROM DATABASE ORDER BY COLUMN DESC?something with Fields(0).value?Thank you in advance

View 4 Replies View Related

No Item Showed

Feb 27, 2007

Hi gurus

I have sql server 2000 that was working fine until today(figures), today I opened EM and under sql server group where used to be all my information now there is NO ITEM, nothing shows(database,Nothing) The server is working as I had no complaints from my user on data not been saved or getting data from but its strange that I can not see all my info like I used to.- If I go into sql query analizer, it ask me to connect to local which I do and I can see all my databases from there but once I close that window ,on my EM nothing shows.

I checked all services andevery one of them seems to be up and runnig

Thanks forall the help I can get

View 4 Replies View Related

How To Get The Max Value Of Duplicate Item

Aug 8, 2007



Hi Every Body,
I have one table it's called -Access.It contains two columns name of that is Door,Emp_Id.
example Door Emp_Id
10 1
10 2
10 3
11 4
12 5
11 1
this is the value in that table.......
I want get Which Door number maximum Access from the table.....
Thanks & Regards,
S.Sajan

View 7 Replies View Related

Totals Per Item

May 2, 2007

Hi Everyone I have an ADP and I need to create a report that will give me the total number of each item. I need the report to show how many [Violation Type], and the total [Loss] per violation. Can anyone help please








Code Snippet

CREATE TABLE [dbo].[Revised_MainTable] (
[I/RDocument] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[IR Number] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Date] [datetime] NULL ,
[Inspector] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Area] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Violation] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Violation Type] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Loss] [money] NULL ,
[Loss Type] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Employee] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Guest] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Action] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Action Type] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Notes] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Security/GC] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO





View 9 Replies View Related

How Can I Add An Item Into Dataset?

Feb 28, 2008

Hi all,

I have some problem about parameter to query data. My parameter is available from dataset but it doen not have blank or null value. So when I want to select this...

SELECT *
FROM mytable
WHERE (@param_person_id IS NULL OR @param_person_id = person_id)

cannot success. This statement means "if @param_person_id has null value, this statement is select every person_id. On the other way, if @param_person_id is not null value, this statement select only specific person_id".

So I want to add blank or null value to my dataset for working with select statement.

How can I do?

Thank you very much

View 1 Replies View Related

Sum Report Item

Feb 19, 2007

Is there anyway to sum a value that resides in a textbox?

ie; =Sum(ReportItems!MyTextBox.value) ?

View 7 Replies View Related

How To Remove Item From A Solution

May 19, 2007

I added something by mistake!  If I delete it it gives me an `are you sure?` message that makes me think it'll actually delete the file from the hard drive. As I've accidentally added something from SQL Server (I was trying to add a database and got carried away) I don't think that's such a good idea.  I've googled and found this:http://msdn2.microsoft.com/en-us/library/1ee8zw5t(VS.80).aspx which helpfully states:----- To remove a solution item In Solution Explorer, select the item you want to remove. On the Edit menu, choose Remove. -----  which would be great, if only the Edit menu had a remove option. Any ideas? 

View 2 Replies View Related

How To Check There Is No Item In Table?

Apr 1, 2008

Hi,I want to check that Is there row exists in table or not.Please correct me.          Dim conn As SqlConnection        Dim comm As SqlCommand        Dim reader As SqlDataReader        Dim connstring As String        connstring = ConfigurationManager.ConnectionStrings("iharyana").ConnectionString        conn = New SqlConnection(connstring)        comm = New SqlCommand("select * from test where username=@username", conn)        comm.Parameters.Add("@username", Data.SqlDbType.VarChar, 20)        comm.Parameters("@username").Value = uname        conn.Open()        reader = comm.ExecuteReader        While reader.Read            If reader.Item("username").ToString = "" Then                Response.Redirect("http://www.iharyana.com")            End If                End While        reader.Close()        conn.Close()

View 1 Replies View Related

How To Count Each Staus For Same Item ?

Apr 10, 2008

I using SQL SERVER
 
just wondering which command I can use to query items status ?
 in my TABLEA
Product(D   |     Name   |      Type |     Status
1                   Apple           Fruit          00021234     
2                   Banana         Fruit         00031244    
3                    Tube            Clothe       00012131
4                     Tee             Clothe       00041111
4                     pants             Clothe       00041112
4                     tank             Clothe       00051111
4                     Jeans            Clothe       00061111
4                     Dress             Clothe       00051111
 
in TABLEB
ID  StatusID  Status
1      0001         A
2      0002         B
3      0003         C
4      0004         D
5      0005         E
6      0006         F
 use this record as a example :
ProductID   |     Name   |      Type |     Status
1                   Apple           Fruit          00021234   
 
use TableA.Status reference to TableB.StatusID  ( compare 0001 , need not to care about the last 4 numbers ) so the status is A
 
AB is Group 1
C   is Group 2
DEF is Group 3
 in my TABLEA
Product(D   |     Name   |      Type |     Status
1                   Apple           Fruit          00021234     
2                   Banana         Fruit         00031244    
3                    Tube            Clothe       00012131
4                     Tee             Clothe       00041111
4                     pants             Clothe       00041112
4                     tank             Clothe       00051111
4                     Jeans            Clothe       00061111
4                     Dress             Clothe       00051111
 
I want the result looks as follow
TYPE   Group 1    Group 2     Group 3
Fruit        1                1             0           //because  Apple           Fruit          00021234     â†’ 0002 = B → Group 1 And Banana         Fruit         00031244 →0003 =C→Group 2
Clothe     1                 0             5
 
I need to run a query to get the result like that , and then put the result to my DataGrid then show to user...
can I just use SQL Query to get the result? I just try to use like sum�Substring ... trying to get the result but I still can't wirte a query to work for this question..
which command I should use for this question? or it must be done in code-behind ?
 can you please give me help?
thank you very much

View 4 Replies View Related

How Do You Receive The Last Item In A Table

Jan 26, 2004

Thats it
How do you receive the last item(row) in a table.
Thanks

View 11 Replies View Related

Item Description In Shorthand

Jun 29, 2005

Hi,

If you browse to Amazon and drill down through categories until a paged
listing appears, you will see in each item of the listing that the
description rendered as Book Description, is a cutdown version of the
full description, with a ... and "Read More" hyperlink.  How is
this achieved programatically? I dont know if thre is an efficient way
in SQL Server to do this, or whether it would be easier to have a
ShortHand field and a Description field, both of which are teh full
description when shown in the Details page, but the ShortHand is the
field rendered in listings.  This seems like a simplistic solution
and I am thinking there may be programmatic means of doing the same -
has anybody got any experience in this area?

Thanks!

jr.

View 4 Replies View Related

Update Count With 1 On First Item. Possible?

Feb 8, 2004

Hello All.

I need your advise on this .....

I have a table with Bill_Doc, Bill_Item and Bill_Doc_Count fields. I need to update Bill_Doc_Count with 1 only on the first Bill_Item. Is this possible? I tried min and max but they don't work for me.

Please help. Thanks a million.

For example,

Bill_Doc Bill_Item Bill_Doc_Count
123 1 1
123 2 Null
123 3 Null
124 1 1
125 1 1
125 2 Null

Best regards

View 5 Replies View Related

SQL 2012 :: Add Value Of Same Item Number?

Aug 26, 2015

My data look like this:

ITEMID DESC QTY PRICE
134 ITEM1 4 $200
134 ITEM1 1 $200
134 ITEM1 1 $200

how do I write SQL stmt to add the quantity if the itemid is the same?

The result should be:

ITEMID DESC QTY PRICE
134 ITEM1 6 $200

View 2 Replies View Related

Locate Item In A Table

Aug 2, 2006

I have a sql table containing names of departments. Is there a way after a user has typed a department in a textbox on a web page I can search for it in the sql table and if it isn't there then add it. I am using asp.net for the web page.

View 3 Replies View Related







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