Need Help In Query - To Get Data From 2 Tables In A Particular Format To Display
Jul 14, 2007
Dear Friends
I need to get the data in the required format. Please help
----------------------
Table TripSheet
----------------------
Id,TSNo.,JourneyDate(ddmmyy),CustName,RateType,VehicleNo., BillId, journey hours, journey km
DATA
1, 234, 1-1-2007, Samson Pvt.Ltd, BPORates, Vehi45, 234, 2 hrs, 60 KM
2, 235, 2-1-2007, Samson Pvt.Ltd, BPORates, Vehi45, 234, 3 hrs, 30 KM
3, 236, 3-1-2007, Samson Pvt.Ltd, BPORates, Vehi45, 234, 2 hrs, 60 KM
4, 237, 4-1-2007, Samson Pvt.Ltd, BPORates, Vehi45, 234, 4 hrs, 40 KM
5, 238, 5-1-2007, Samson Pvt.Ltd, BPORates, Vehi45, 234, 2 hrs, 60 KM
6, 239, 1-1-2007, Samson Pvt.Ltd, BPORates, Vehi99, 234, 2 hrs, 60 KM
7, 240, 2-1-2007, Samson Pvt.Ltd, BPORates, Vehi99, 234, 3 hrs, 30 KM
8, 241, 3-1-2007, Samson Pvt.Ltd, BPORates, Vehi99, 234, 2 hrs, 60 KM
9, 242, 4-1-2007, Samson Pvt.Ltd, BPORates, Vehi99, 234, 4 hrs, 40 KM
10, 243,5-1-2007, Samson Pvt.Ltd, BPORates, Vehi99, 234, 2 hrs, 60 KM
----------------------------
Table BillTripSheet
-----------------------------
Id,BillId,VehicleNo., TotalJourneyHours,TotalJourneyKM,SlabApplied, MinAmt, ExtAmt
DATA
1, 234, Vehi45, 13hrs, 250km, SlabA, 500, 50
2, 234, Vehi99, 13hrs, 250km, SlabA, 500, 50
I need to display data to be displayed in the following format in report
(grouping based on vehicle no.)
1, 234, 1-1-2007, Samson Pvt.Ltd, BPORates, Vehi45, 234, 2 hrs, 60 KM
2, 235, 2-1-2007, Samson Pvt.Ltd, BPORates, Vehi45, 234, 3 hrs, 30 KM
3, 236, 3-1-2007, Samson Pvt.Ltd, BPORates, Vehi45, 234, 2 hrs, 60 KM
4, 237, 4-1-2007, Samson Pvt.Ltd, BPORates, Vehi45, 234, 4 hrs, 40 KM
5, 238, 5-1-2007, Samson Pvt.Ltd, BPORates, Vehi45, 234, 2 hrs, 60 KM
----------------------------------------------------------------------------------------------------------
1, 234, Vehi45, 13hrs, 250km, SlabA, 500, 50
---------------------------------------------------------------------------------------------------------
6, 239, 1-1-2007, Samson Pvt.Ltd, BPORates, Vehi99, 234, 2 hrs, 60 KM
7, 240, 2-1-2007, Samson Pvt.Ltd, BPORates, Vehi99, 234, 3 hrs, 30 KM
8, 241, 3-1-2007, Samson Pvt.Ltd, BPORates, Vehi99, 234, 2 hrs, 60 KM
9, 242, 4-1-2007, Samson Pvt.Ltd, BPORates, Vehi99, 234, 4 hrs, 40 KM
10, 243,5-1-2007, Samson Pvt.Ltd, BPORates, Vehi99, 234, 2 hrs, 60 KM
----------------------------------------------------------------------------------------------------------
2, 234, Vehi99, 13hrs, 250km, SlabA, 500, 50
----------------------------------------------------------------------------------------------------------
The Calculation logic is lengthly and the number of records involved is huge.
also, only the manager has authority to generate the Bill and rest of the team can view the bill report
So i cannot do the calculations while fetching the records, Bill has to be generated and stored.
How do i write the query to fetch the data from the two tables "TripSheet" and "BillTripSheet" ? Please Help
Reagards
Sara
View 6 Replies
ADVERTISEMENT
Jul 21, 2015
I have to display the data in the below said formats..Current sample Data in the table and the data type is numeric(23,10)
50.00
0.50
0.00
0.00
To be displayed in the below format
1.25
0.75
0
0
1
I have to map this column in teh report and should dipslay like above.I think if 0.00 is available then it should display as 0..If 1.0 is available then it should display 1.Any value that has postive number after the decimal should display all the values example : 2.25,3.75,5.06, So in general the solution to display values like 1.75,1,0 we should not dispaly 0 as 0.00 and 1 as 1.00 and 2 as 2.00 and so on...Any Solutions in terms of SQL query or SSRS expression.
View 5 Replies
View Related
May 23, 2008
Hi Guys,
Below is example of the current structure of table1 I have at run time:
------------------------
GroupName Resourcename Week1 Week2 ..cont.. dynamically
Associates A1 0 80 ......
Assocaites A2 20 40 ......
Associates A3 50 100 ......
Principal P1 20 100 ......
Principal P2 0 0 ......
Principal P3 0 100 ......
------------------------
I want to change the above to something like below table2:
---------------------------
GroupName Status Week1 Week2 ....cont
Associates Assigned 2 3
Associates NotAssigned 1 0
Principal Assigned 1 1
Principal NotAssigned 2 1
---------------------------
I will try to explain how I am deriving table2 from table1. I have to count the number of Resource name against each Groupname for a particular week column(Weeki i 1 to n dynamic) where value of Week column is 0, then use this numbber against NotAssigned and the complementary number to be stored as Assigned.
The table formaating is lost in HTML view but just consider any gaps between fields as next column value.
Am I clear in what i am asking , if not please ask me.
Any help will be highly appreciated.
View 2 Replies
View Related
Jul 16, 2015
I want a ssrs report with two tables adjacent,using same data set. I want to start row number/records in second table where rownumber of first table ends.and in second page first table should start where second table of first page ends.
View 10 Replies
View Related
Feb 5, 2008
Hi guys n gals !
I am having a few problems manipulating the results of my data reader,To gather the data I need my code is:
// database connection SqlConnection dbcon = new SqlConnection(ConfigurationManager.AppSettings["dbcon"]);
// sql statement to select latest news item and get the posters name SqlCommand rs = new SqlCommand("select * from tblnews as news left join tblmembers as members ON news.news_posted_by = members.member_idno order by news.news_idno desc", dbcon); // open connection dbcon.Open();
// execute SqlDataReader dr = rs.ExecuteReader();
// send the data to the repeater repeater_LatestNews.DataSource = dr; repeater_LatestNews.DataBind();
Then I am using: <%#DataBinder.Eval(Container.DataItem, "news_comments")%> in my repeater.What I need to do is pass the "news_comments" item to a function I created which will then write the result. The code for my function is:
// prevent html public string StripHtml(string data) { // grab the data string theData = data;
// replace < with &alt; theData = Regex.Replace(theData, "<", "<"); // return result return theData; }
But I am having problms in doing this,Can anyone point me in the right direction on what I should be doing ???
View 2 Replies
View Related
Nov 11, 2007
Hi,
I'm using SSRS to generate reports. i have many columns data to be displayed.while converting the data into Excel and PDF the data, header, and footer are not displaying proper format. what are all the properties to be set for that.
Could any one help in this regard.
Thanks for your help..
View 1 Replies
View Related
Dec 22, 1999
When I select a table and try to view the data I take the return all rows or return top option. However nothing is displayed. These options worked before and I don't understand why it's not working now. Can anyone help?
View 1 Replies
View Related
Oct 2, 2007
Hi there
Assuming this is the query used to return this result:
select dept.name, count(prj.id) from department dept, project prj where prj.id = dept.uid group by dept.name
Dept, TotalProj
A , 10
B , 5
C , 2
Question: How do I change the query so that the result will return as follows:
Dept/TotalProj
A, B, C
10, 5, 2
View 5 Replies
View Related
Oct 23, 2014
I have a table that I am trying to query to display all data connected to a id in one row. What is the best way to achieve this?
Something like this:
ID| CRS1 | CRS2 | CRS3| CRS4 ....
1 | A101 | A102 | A103 | A104 ....
CREATE TABLE Class
(
id int,
yr int,
trm varchar(2),
crs varchar(30)
[Code] .....
View 3 Replies
View Related
Jul 20, 2005
Hi,In my application, I need to copy data from an Excel file into a SQLtable. The article related to this can be found athttp://support.microsoft.com/defaul...Ben-us%3B306572Using this,I am first extracting data from given excel file into atemporary DataTable. After making some operations on that DataTable(like splitting one column into two), I am saving the data into actualtable in SQL Server.My doubt is that, in the above given link, there are few steps neededto do on the excel file... eg.--> Highlight the rows and columns where the data resides.--> On the Insert menu, point to Name, and then click Define.--> In the Names in workbook text box, type myRange1, and then clickOK.I don't want my client to do thsese operations everytime he changescontents in that excel file, as this excel file changes almost daily.The extracting of data from excel file is done after clicking UPDATEbutton on webpage. The person saving data into Excel file is differnetfrom the one who updates it into SQL.Is there any other way where we can directly copy data from excel fileinto DataTable without doing the above three steps?I am using Visual Studio.NET 2003,SQL Server 2000 and C# as developinglanguage for this web-based project.Any advice would be greatly appreciated. Thanks in advance.Regards,RK.
View 4 Replies
View Related
Feb 28, 2008
Hello,I have a (big) table which is not normalized, but for i need at themoment i thinkthat's no problem. Indeed, what i would like to do is to select thename field andthe note. The problem is that i want to display the note in 2different columns.the first columns will show the number (count) of time that a certainnote (e.g note=4)appears for a certain name and in the other column the same thing butfor a different note value.so each column noteX will display the number of time that the notewith the value X appears for each namefor example, to the following table:Name | note | job | city | id |----------------------------------------john | 4 | jb1 | hamb | 1 |john | 5 | jb2 | hamb | 2 |john | 5 | jb3 | hamb | 3 |john | 5 | jb4 | hamb | 4 |Mark | 4 | jb1 | mun | 5 |Mark | 4 | jb2 | mun | 6 |Mark | 4 | jb5 | mun | 7 |Mark | 5 | jb1 | mun | 8 |peter | 5 | jb3 | berl | 9 |peter | 5 | jb5 | berl | 10 |frank | 4 | jb6 | v.form | 11 |frank | 5 | jb3 | v.form | 12 |frank | 5 | jb2 | v.form | 13 |the result should be:Name | note5 | note4 |-------------------------john | 3 | 1 |Mark | 1 | 3 |peter | 2 | 0 |frank | 2 | 1 |How should be the right SQL command to show the data i want?Rui DiasJoin Bytes!Thanks a lot
View 5 Replies
View Related
Oct 2, 2006
Hi
I have a table that stores the period and year as two seperate fields the problem that i have is that when the data is entered in the data base the period is sometime entered as 6 or 06, hence i have a table thaat looks like as follows:
Period Year
====== ====
6 2006
06 2005
12 2006
3 2005
2 2005
4 2005
04 2005
03 2005
when i currently query the information using the period i use the LIKE command in SQL which gives me the results but the problem is when the like is done with 2 as the period value it also retrieves the 12, 02, and 2, in that case the period 12 was not that was requested.
I was wondering is there a way to reformat the data so that all the data is in a consistent format?
Or is there a better way of quering the information in the current format?
View 13 Replies
View Related
May 30, 2000
Hello folks!
When I do a select on a date field, the date in 6.5 was displayed as-
Jan 1 1999 12:05AM
In 7.0 it is displayed as-
1999-01-01 00:05:00.000
Can anyone please shed some light on this? ie. why is there this difference? Also can this display format be controlled (by server language used or regional date setting)?
Thanks!
- Manoj
View 1 Replies
View Related
Jul 23, 2005
Hi!I'm wondering is there any simple way to achieve the followingfunction call in SQL Server. The sentence to translate is (Oraclesyntax):to_char(rownum, '000')rownum: number of the current rowto_char: formats a number (the 1st param) according to the formatdefined in the 2nd param. In this case, the '000' preprends 2 or morezeros until forming a 3-digit number.I'm using it in something like:SELECT id_table, string_column || TO_CHAR(ROWNUM,'000') FROM tableThanx a bunch,Cro
View 6 Replies
View Related
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
Nov 12, 2007
Hi,
I am using a sql database and vb.net... In form i display a date from calendar as smalldatetime in the format of dd/MM/yyyy by changing the web.config file to culture = "en-GB"... It did display as dd/MM/yyyy with no doubt... Problem is in sql database it is display as mm/dd/yyyy, there4 when i retrieve it out, it is not the format i wan... so can any1 helps mi? I need do many adding and subtracting to the date so a constant dd/MM/yyyy format is veri important to mi... I cant save it as yyyy/mm/dd cos my boss dun wan it... If use Convert method when i select * out how to convert the date zzz
Helps would be greatly appreciated
View 9 Replies
View Related
Apr 9, 2004
Hi,
Is it possile to definea custom format for the 'display format' property of a measure so that the results are shown in Thousands or Millions or Billions e.g
100,000 can be shown either as 100T
OR
1,000,000 can beshown as 10M
OR
10,000,000 1B
Sorry if I got my numbers wrong but I hope you get the idea?
Looking forward to your help. Thanks
View 1 Replies
View Related
May 5, 2008
Hi all
I am using local reports.(.rdlc files)
My requirement is when the user selects some options in the form and click on Submit buttion,He should get report in PDF format directly.Is it possible?if possible give me some example code.No need to preview in general format.
Help me.
Regards.
View 3 Replies
View Related
Jul 20, 2005
Hi all,i'm working with SQL Server for about 4 years, and i have eversearching for a tool which can script my DATA in a T-SQL format tocopy them very easy from one server to another.For example scripts like that:IF NOT EXISTS (...)INSERT INTO (...)ELSEUPDATE (...)I have never found a tool like that, so i write a it by myself.This software is a free version in the moment, you can download it onmy website:http://www.sqlscripter.com..NET Framework on your client PC is required.Have fun with it ...Thomas
View 2 Replies
View Related
Dec 28, 2007
Hi,
My first post here. I have an Analysis Services Cube and I need to export some of its data into a flat file (a semicolon separated value file) with fixed length columns.
What I have in Integration Services now is:
DataReader Source (ADO.Net conection)
Data Transformation (NTEXT -> WSTR)
Derived Column (WSTR -> STR, and some ISNULL validation)
Flat File Destination (Delimited by ";")
the thing is I have all the measures and calculated measures in the cube formated with format strings and they work fine when I do a query through the SQL server Managment Studio, but in Integration Services before the columns are written into the file they lose its format.
for example, I have a calculated member called "Deuda Total Nacional" that returns something like this +0001234,00 and I need to take off the decimal separator so it is written into the file like this +000123400 , I'm doing it this way
(ISNULL([Deuda Total Nacional]) ? "+00000000000" : REPLACE([Deuda Total Nacional],",",""))
instead it is written like this 1234.
I hope you can help me with this.
Thanks
View 14 Replies
View Related
Nov 12, 2007
I have a requirement to display the elapsed time between two datetime fields. What i have been able to do is datediff the dates and get the elapsed time in minutes and then i am trying to format it as HH:MM.
For example, an activity started on Nov 1 2007 08:00 and finished Nov 1 23:59, the elapsed time should be displayed as 15:59.
The other example is if the activity spans over a couple of days, it should be say 49:03.
I put the following code in the format of the textbox, but it only seems to work when the length of the minutes is greater than 1.
=IIF(Len(CStr(Fix(ReportItems!textbox11.Value/60)))= 1,
"0" + CStr(Fix(ReportItems!textbox11.Value/60)),
CStr(Fix(ReportItems!textbox11.Value/60)))
+ ":"
+ IIF(Len(CStr(Fix(ReportItems!textbox11.Value Mod 60)))= 1,
"0" + CStr(Fix(ReportItems!textbox11.Value Mod 60)),
CStr(Fix(ReportItems!textbox11.Value Mod 60)))
Have i missed something really simple or what? Any help would be much appreciated.
Alternatively, if you have a better way of doing the whole thing would like to hear from you.
Thanks in advance.
View 1 Replies
View Related
Apr 12, 2007
Need some quick help here.. The data I got from the text file use the "04/11/2007" date format and the StockDate in MS-SQL use the datetime datatype.
My understanding is that the "04/11/2007" will default to the 04/11/2007 12:00 am" format in MS-SQL.
So, when I use the sql query, how do search only for the date part of the data in MS-SQL and match it to the data from text file? I tried this SQL Query below.
--snip--
SELECT RawID FROM tblPurchaseRaw WHERE VIN = '" & sVin.ToString.Trim & "' AND StockDate = '" & dStockDate.ToString.Trim & "'
--snip--
That way, if I get a row then I know the data is there. If I don't get a row then I know the data is not there.
Bold: I get it now. It is all automatic as MS-SQL does it automatically...
View 5 Replies
View Related
Apr 28, 2014
I'm sending report based on below DB Mail query from mentioned data format table. But i'm getting invalid format output in csv file.
Table Data:
CREATE TABLE Sales_Data
(
ITEM_CODE varchar(25),
Price float,
Purchased_Date Datetime
[code]...
View 5 Replies
View Related
Jun 18, 2015
I have below table:
IF OBJECT_ID('tempdb..#complaints') IS NOt NULL
DROP TABLe #complaints
--===== Create the test table with
create table #cs([Year] float,
[Week] float,
[Month] float,
[C#] float,
[Dept] nvarchar(255)
,[Issue] nvarchar(255), [Type] nvarchar(255), [Dept age] nvarchar(255))
--===== All Inserts into the IDENTITY column
INSERT INTO #cs
([Year], [ Week], [ Month], [C#],[Dept],[Issue], [Type], [Dept age])
SELECT 2015, 14, 4, 188, D1,I1,T1, 5 UNION ALL
SELECT 2015, 14, 4, 452,d1, I1, T2, 5 UNION ALL
SELECT 2015, 14, 4, 63, d1, I1, T1, 6 UNION ALL
SELECT 2015, 14, 4, 9, d1,I2, T1, 7 UNION ALL
SELECT 2014, 14, 4, 187, D1,I1,T1, 5 UNION ALL
SELECT 2014, 14, 4, 451,d1, I1, T2, 5 UNION ALL
SELECT 2014, 14, 4, 62, d1, I1, T1, 6 UNION ALL
SELECT 2014, 14, 4, 10, d1,I2, T1, 7 UNION ALL)
and i want to have a table in below format: (query for it)
Week, Month, C1#,c2# Dept,Issue, Type, Dept age
14, 4 188 187 d1 i1 t1 5
14, 4 452 451 d1 i1 t2 5
I.E. I WANT two columns C1# and C2#, where C1# contains data from 2015 and C2# contains data from previous year (2014). If 2015 data is not present, then C1# will contain data of 2014 and C2# will contain data of 2013.
View 9 Replies
View Related
Aug 19, 2015
I have a table Test123 having three column EmpID,AttribName,AttribValue.
run the below query to generate table structure and data.
Create Table Test123(EmpID int,AttribName varchar(50),AttribValue varchar(50))
insert into Test123 values(1,'Name','X')
insert into Test123 values(1,'Age',50)
insert into Test123 values(1,'Salary',1000)
insert into Test123 values(2,'Name','Y')
insert into Test123 values(2,'Age',30)
insert into Test123 values(2,'Salary',2000)
insert into Test123 values(3,'Name','Z')
insert into Test123 values(3,'Age',35)
insert into Test123 values(3,'Salary','One Hundred')
And I want output in below format.
AttributeValueType
=================
AGE | NUMERIC
NAME | ALPHABET
SALARY | ALPHANUMERIC
==================
View 6 Replies
View Related
Jul 30, 2015
I've come accross this code and need to alter it to display a normal General Date format.
CASE WHEN p.BIRTHDTTM IS NULL THEN ''
ELSE RIGHT('0' + LTRIM(CONVERT(VARCHAR(20), BIRTHDTTM, 113)) , 20)
END AS BIRTHDTTM
The original data (which is a DOB field) looks like this
1936-08-14 00:00:00.000
And the code above is turning it into this which is good but means I cannot then format in SSRS
14 Aug 1936 00:00:00
So ideally I'd like the code above to be altered so that it gives me
14/08/1936
View 14 Replies
View Related
Aug 28, 2007
I'm querying a database table that creates a time stamp in seconds only. I have a starting time of
1099725928 = 11/6/2004 12:25:28 AM. So that if another entry is made 1 second later the time stamp value entered into the table is 1099725929. The front end application does the converstion from the seconds counter to the datetime format. The query I am writing calls information from this table for a different application that does not have the conversion capability. If I know the starting point (I don't want to create a conversion table) which is 1099725928 = 11/6/2004 12:25:28 AM, is it possible to write into my query script a function to convert the seconds value to the correct datetime format? It would need to accurately account for leapyear and even/odd months.
************************************************************************************************
Select Case_ID_, Region, Assigned_To_Group_, Assigned_To_Individual_,
Status, Priority, Category, Type, Item, Affiliate, Hours_to_resolve, Resolved_Time, Assign_Time, Create_Time
From HPD_HelpDesk
Where Region = 'Central Valley'
and Assigned_To_Group_ = 'CVSA Desktop Support'
and Status In (1, 2, 3, 4, 5)
and Priority In (0, 1, 2, 3)
Order by Case_ID_ Desc************************************************************************************************
View 6 Replies
View Related
May 19, 2014
Power pivot graph. I do have different transaction names, dates, count, exec time with me, I need to display each transaction execution day, execution time in graph format. Suppose execution time is on Y axis and Exec time is on X-axis then to display the which transaction takes more time for execution.I have Query just I need to display in graphical format
View 1 Replies
View Related
Apr 25, 2015
I have doubt In ssrs while doing report like If We have Amount Column In a Table, then I want to display amount in letters Format.
Ex: 5000 /- Now I want to display Amount As Five Thousand Rupees Only.
View 3 Replies
View Related
Jun 1, 2015
Need to display current time in below format:
06/01/2015 at 7:00 a PST
(Date at time TimeZone)
View 2 Replies
View Related
Jan 22, 2007
Hi all,
I am using ASP.NET 2003 with SQL Server as database.
I have a database of a book store with BookPicture, Author, Title, and Description of the Book.
Now when the user searchers for a book with a keyword, how can I display the results which should show:
1. The picture of the book, 2. The at it right, Title of Book, 3. The author,4. The descritionThen the image of "Add to cart"
Each search result must be separated by a box like the cell of a table.
Is it possible to be done?
Thanking you in advance
Tomy
View 2 Replies
View Related
Mar 16, 2014
i m creating one google map application using asp.net with c# i had done also now that marker ll be shown from database (lat,long)depends on the lat,long i wanna display customer,sales,total sales for each makers in html table format.
View 2 Replies
View Related
Sep 17, 2015
I am trying to create a Datazen query against a Microsoft SharePoint List. The Data View successfully returns records from the list; however, it appears that the Query String parameter is entirely ignored. I want to use the query string to grab only records with a certain status value.
So far I have attempted specifying a View and Filters:
?View={B9FF1729-AB8E-4C55-B17C-C660480334BB}&FilterField1=Status&FilterValue1=Closed&FilterField2=Request%5Fx0020%5FType&FilterValue2=Project
Just the filters:
?FilterField1=Status&FilterValue1=Closed&FilterField2=Request%5Fx0020%5FType&FilterValue2=Project
And even:
?ThisWillDoNothing
All return the complete set of records in the list. I do not see a single example or comment online other than the claim that SharePoint List sources are supported. How I can specify a Query String value that will filter the list records?
View 2 Replies
View Related