Query Is Not Displaying All Columns
Feb 9, 2015
I created the following simple query between two tables:
SELECT vru.User_Name0, vru.Full_User_Name0, vru.department0, vru.employeeNumber0,
vru.title0, vru.manager0, vrs.location0, vrs.Netbios_Name0, vrs.Last_Logon_Timestamp0
FROM v_R_User vru
LEFT JOIN v_R_System vrs
ON vru.ResourceID = vrs.ResourceID
ORDER BY vrs.User_Name0
I don't know how to properly insert a pic, but basically I get output, except the last 3 columns. I've tried every variation of JOIN and I cannot seem to solve this issue.
View 6 Replies
ADVERTISEMENT
May 9, 2008
Hello All,
I have a little problem. Here is the scenario:
I got two tables Asset and Personnel
Personnel has FirstName, LastName,and username which is unique.
Asset table stores all information related to an asset and the username to whom the asset is assigned and the POC username.
The tables look like this:
Personnel Table
FirstName, Last Name, UserName
John, Doe, jdoe
Bill, Smith, bsmith
Asset Table
POCUserName, AssigneeUserName
jdoe,bsmith
My problem arises when I want to display First Name and Last Name for both the POCusername and the AssigneeUserName since FirstName and LastName columns exists once in the Personnel table. How can I display the columns twice. Lets say POCFirstName, POCLastName, AssigneeFirstName, and AssigneeLastName. Or this is something that can't be done.
The query below only display the Assignee info. Of course, I need to something else to display the POC info as well...don't where to go from here...
select tblPersonnel.FirstName, tblPersonnel.LastName, tblAsset.AssigneeUserName, tblAsset.POCUserName
from tblVendor, tblAsset, tblPersonnel
where and tblPersonnel.UserName = tblAsset.AssigneeUserName
and tblAsset.POCUserName in(select tblPersonnel.UserName from tblAsset, tblPersonnel
where tblPersonnel.UserName= tblAsset.POCUserName)
Any help is greatly appreciated
~
N
View 3 Replies
View Related
Jan 31, 2008
Hi,
Im trying to create a calulated value in my matrix table
I have the following matrix
ADSL CABLE BROADBAND %of adsl %ofcable %ofbroadband
AWAITING 5 9 11 0.2 0.36 etc
IN PROGRESS 67 10 5 0.8 0.1 etc
CHURNED 8 1 15 0.3 etc etc
I would like to create columns called
% of ADSL
% of cable
% of broadband
which is the count for that product divided by the total off adsl+cable+broadband for that particular status
I have the following problems
1. How do I add columns to a matrix which would allow these calculated columns to display?
thanks
View 3 Replies
View Related
Apr 13, 2012
Ihave 2 tables...they are basically the same except for the column name in one of them because they deal with 2 different names, though..the data i want is in columns that have the same name.pretty much what i want to do...is .they also need to be distinct so i dont count duplicates...i can get them as separate tables...but i cant get them together..I need them in 1 column because of how it is sent to the C3 code page and how it reads it...the structure has already been previously set..and there are about 5 other statments that are being executed in this one stored procedure like this (also i wasnt the one who set this up).
image 1 is what is currently set up
imgur: the simple image sharer
top part is what is stored in tables..bottom is more of the result
it basically runs this code to get the bottom
DECLARE @id INT;
DECLARE @invest nvarchar(50);
SET @id = '7633';
SET @invest = '';
SELECT 'a' + CONVERT(nvarchar, orderfindings.risk_rating) AS cat, COUNT(DISTINCT orderfindings.prnt_id) AS stat
FROM orderheader, orderaudits, orderfindings
WHERE orderheader.id = orderaudits.orderheader_id AND orderaudits.ID = orderfindings.prnt_id
AND orderheader.id = @id AND orderfindings.risk_rating > 0 AND orderaudits.Investor_Name LIKE '%' + @invest + '%'
GROUP BY orderfindings.risk_rating
If i want agencies instead of findings..just replace it..agencies and findings are the 2 tables..they are the pretty much identical column wise...but i want the result together..i've tried several ways..but i cant seem to get it.
image 2 - the table at the bottom is more what i'm looking for..it combines them both into 1
imgur: the simple image sharer
if an order has a finding or agency or both in it..then it gets marked as a 1 for that risk rating...if it doesnt..then 0 for that risk rating..and then sum them all up to see what i got..
I've been working with it...did this [SQL] compare2 - Pastebin.com ..got it to display 2 columns..but still not the right result...i'm getting a1 = 1...a2 = 1...so its not running through all the orders...or it needs a way to count it...i put a sum at beginning of case statement..erro because of counts...so i took counts out...
View 7 Replies
View Related
Oct 7, 2015
I want to display Month and year from same time hierarchy in two separate columns.My hierarchy is as below:
Ship Date > Ship Date Hierarchy
Ship Date year
Ship Date Quarter
Ship Date month
The display I am looking for is as below
Ship Date year Ship Date Month
measures
2015 Jan
200
2015 Feb
300
I am using Tail function as I need only the last 13 months, below is my query:
with set [Month] as
{
tail([SHIP DATE].[Ship Date Hierarchy].[SHIP CAL MTH].members, 13)
}
select
{[Measures].[TAG BUID Distinct Count]} on 0,
{[Month]* [SHIP DATE].[Ship Date Hierarchy].[SHIP CAL YEAR]} on 1
from
[GSDR_P4]
This gives me error that The Ship Date Hierarchy hierarchy is used more than once in the Crossjoin function.
View 2 Replies
View Related
Jun 14, 2007
Is it possible to display only a certain number of columns in a matrix, say the first 6 and then hide the rest? That is, does the matrix allow to somehow control how many columns can be displayed from a column group and hide the remaining columns (I need this to limit the number of columns a user is able to see so that the matrix width does not get infinitely long).
In other words.....
I need to display the subtotals for all dynamically generated columns but display only first 6 columns. This way I can avoid having to display 50 columns and not have user scroll to so far right and keep the page width within reasonable limits. Hope I have made it clear.
Thanks.
View 3 Replies
View Related
Sep 5, 2014
I have a view I've created which displays client sortname, partner and date added which displays 7 results.
When I add another table to this view to display the Industry it then only gives me 4 results as the other 3 results have no Industry instead of giving me the 7 results and showing the Industry column as empty for the other 3.
Is there a way I can make it show all 7 results and havethe column where the industry is empty display the other results instead of not displaying any results at all for them?
Script:
SELECT dbo.cdbClient.cltSortName AS ClientName, dbo.vcltAttrib4.ainTVal AS ClientPartner, dbo.vcltAttrib422.ainDVal AS [Date Added],
dbo.cdbAttribInst.ainTVal AS Inudstry
FROM dbo.cdbClient LEFT OUTER JOIN
dbo.cdbObject ON dbo.cdbClient.cltCategoryID = dbo.cdbObject.objID LEFT OUTER JOIN
[Code] ....
In the above script the cbdAttribInst table has the Industry column I need which is 'ainTVal'...
View 8 Replies
View Related
Dec 3, 2006
I think I've seen a similar post on a blog or on the forums - but it seems like this should be possible -
I have an MDX query - that works fine in SQL Enterprise Manager, and has my dimension members on columns, and my measures on the rows. When I try the same query in Reporting Services, I get the error:
"The query cannot be prepared: The query must have at least one axis. The first axis of the query should not have multiple hierarchies, nor should it reference any dimension other than the Measures dimension..
Parameter name: mdx (MDXQueryGenerator)"
Although it works when you pivot the view, I really need my data presented with the members on the columns and the measures on the rows. Another forum post mentioned using the SQL 9.0 driver, but I can't see this listed anywhere (the only one I see is the .NET framework Data Provider for Microsoft Analysis Services).
Here's what my query looks like -
SELECT
{ [Time].[Month].&[2006-09-01T00:00:00] ,
[Time].[Month].&[2006-10-01T00:00:00],
[Time].[Month].&[2006-11-01T00:00:00],
[Time].[Month].&[2006-12-01T00:00:00]
} on COLUMNS,
{
[Measures].[Unique Users],
[Measures].[UU Pct 1],
[Measures].[UU Pct 2],
} ON ROWS
FROM [Cube]
Any ideas?
Thanks,
Arjun
View 8 Replies
View Related
Sep 10, 1999
Hi all!
I´m getting a very unpleasant result when I use "SELECT * FROM <many-columns-table (40+)>". Each query row appears with overwritten columns (not all but some of them)... also outside EM window !!!
There is no data corruption on EM nor Windows, all programs remains running with no other sign but garbage overwritten... garbage dissapears after window refreshing.
Just 1 month ago I made a 2-day full reinstall of my computer, so I don´t know what program could install an offending module/DLL/??? buy I´m sure it was working before. I hate that!
Have you ever noticed something like that?
Do you think is a DLL problem?
Do you know a turn around? (I don´t want to reinstall all again!!!)
Actually I´ve tried reinstalling SP4, SP5 on WS, uninstalling/reinstalling Client with no luck...
Thanks,
Cesar.
View 1 Replies
View Related
Aug 9, 2007
Hi,
I would like to know how would i display following data.
exa:- (Note:- I wrote '---' so to display properly in to the forum
Table1
ComputerName--IpAddress
ABC1-----------10.1.2.3
ABC1-----------10.1.2.4
ABC1-----------10.1.2.5
ABC2-----------10.1.2.6
ABC2-----------10.1.2.7
ABC3-----------10.1.2.8
ABC3-----------10.1.2.9
ABC4-----------10.1.2.10
Table2
ComputerName--NetCard
ABC1-----------<card1>
ABC1-----------<card2>
ABC2-----------<card3>
ABC2-----------<card4>
ABC3-----------<card5>
ABC3-----------<card6>
Table3
ComputerName--Model
ABC1-----------DEll
ABC2-----------DEll
ABC3-----------DEll
Now i want output should be displayed like this
ComputerName--IpAddress--NetCard Model
ABC1-----------10.1.2.3---<card1>---DEll
----------------10.1.2.4---<card2>
----------------10.1.2.5
ABC2-----------10.1.2.6---<card3>---DEll
----------------10.1.2.7---<card4>
ABC3-----------10.1.2.8---<card5>---DEll
----------------10.1.2.9---<card6>
ABC4-----------10.1.2.10
Black filled should not displayed anything
Is it possible
--------------------
Thanks and regards
Abhishek Joshi
India- Bangalore
View 4 Replies
View Related
Apr 14, 2008
Hye Friends,
I'm using a DMX query to get some predictions out of my MiningModel
my DMX query is as follows :
SELECT
predict([x SalaryPredictor].[Emp Gross],20),predict([x SalaryPredictor].[Emp Basic],20)
From
[x SalaryPredictor]
This query is returning me 2 objects of type expressions in my Dataset.
The problem is when I try to drag these 2 fields in my Table i get a "#Error" value
I executed the query in 'Data' tab and found that data is getting returned is a tree like format where "Expression" is at top & values expected ar its child nodes.
I also found out that the returned objects are actually AdomdDataReader , but i'm not able to write a expression to get its values in my tables....
I want to display the values in the following format....
_____________________________
| Emp gross | Emp basic |
---------------------------------------------------
| predicted val 1 | predicted val 2 |
---------------------------------------------------
| .... | ..... |
-- -------------------------------------------------
can anybody help me out in this ????...
Thanks in advance !!!
View 1 Replies
View Related
Oct 16, 2007
Is there a way to create an expression that references the DataSets / Queries? I'd like to be able to create an expandable text box that shows the raw sql query used to generate the report.
View 4 Replies
View Related
Apr 14, 2006
Hello all
please see this query
select * from Table1 where Table1ID in
(select Table1ID from Table3)
Step1 )select Table1ID from Table3
output->Giving error as Table1ID is not valid column in Table3 .
Step2)select * from Table1 where Table1ID in
(select Table1ID from Table3)
Output-> Giving all records of Table1 as i am expecting error from this query .
Please check with your demo database and reply.
Thanking you.
Ramana.
View 7 Replies
View Related
Aug 31, 2000
I've got a union query (below)and it returns rows that have duplivate itemno's, descrip's, imsrp3's, and imsrp4's, while the remaining columns are not duplicate for the same row. An Excel report uses this query to populate itself and for a more visually appealing look, I'd like to skip the duplicated columns in the display. I'm not sure how to use the Distinct or Group by in this case, since technically I'm dealing with two separate queries, neither one separately returning any duplicate rows.
thanks for any suggestions...
~
select itemno,descrip,imsrp3,imsrp4,qoh,border,wadcto,wad oco,
watrdj,wapddj,wauorg,wauser
from nowo
where nowo.wasrst <='40'
union
select itemno,descrip,imsrp3,imsrp4,qoh,border,wadcto,wad oco,
watrdj,wapddj,wauorg,wauser
from nopo
where nopo.wasrst <='499'
View 1 Replies
View Related
Mar 13, 2012
I have a query where I have customers, date they ordered a swatch, date they ordered an item, and eh date diff between the two. I want to show the MIN date diff for each customer, and also show the swatch date and item date as well. But to use the MIN aggregate, it forces me to group everything, where I just want to group by customer, and have the 2 dates tag along, because i only want one record per customer. What is the easiest way for me to accomplish this?
SAMPLE:
CustKeySwatchDateRugDateDateDiff
10903963126678366
10903963126837525
10903963126960648
10913962286550322
1115886193625764
1129666456646711
1146986229625324
1146986229627647
11469862296667438
1146986656666711
1146986624666743
DESIRED RESULTS:
CustKeySwatchDateRugDateDateDiff
10903963126678366
1115886193625764
1129666456646711
1146986656666711
View 7 Replies
View Related
Jun 10, 2015
This syntax is not displaying verified OR timespentinclass accurately. Where did I miss syntax?
DECLARE
@studentid varchar(50)
SET @studentid = 'ALL'
declare
@count int,
@course varchar(100),
[Code] ....
View 11 Replies
View Related
Apr 7, 2008
Hello all,
I have a problem... I have a SELECT query I have used in my PHP report. It is as follows:
SELECT DISTINCT callref, CASE WHEN (stage.due_date < stage.completed_date) THEN 'SLA Breach' ELSE ' In SLA' END AS sla
FROM tableX....
WHERE call_status=open.....
I wish to search through all stages (i.e response, fix, end) of the calls logged in our database, & then return 'In SLA' for each call that had all its stages completed within the SLA, & 'Breach' for all calls that had even one of its stages completed outside its SLA.
At the moment the SELECT query above gives me the following results:
Call Ref sla
10001 In SLA
10002 Breach
10002 In SLA
10003 In SLA
10004 In SLA
10005 Breach
10005 In SLA
... ...
What it should look like is this....
Call Ref sla
10001 In SLA
10002 Breach
10003 In SLA
10004 In SLA
10005 Breach
... ...
Please let me know if anyone has the answers or any clues to this! thanks.
View 5 Replies
View Related
Jul 23, 2005
The row counts I am getting from SQL Enterprise Manager and QueryAnalyzer are different. When I double click a table in EnterpriseManager it gives me a row count of say 1000. However, when I select *from that same table in Query Analyzer it returns 1028 rows. Anyoneknow why or better yet, how to fix it? Thanks!
View 2 Replies
View Related
Nov 16, 2013
I've got a SQL2008 database with 2008R2 Express loaded.
In VS2012 if I right click a table and select New Query, I get the Visual Designer.
In VS2013, same database, I get a blank page
I've tried a fresh install of 2012 and 2013 onto a fresh Win8.1, same thing. SQL2012 Express, same. If I use an LocalDB option, again no tools. I've tried Ultimate to see if it's something not in Pro.
Also the "code only" query doesn't connect me to the file properly, so even if I accept doing the query by hand, I have to paste a connection string every time.
I'm expecting it to do as per VS2012, and the VS2013 pages in [URL] My database is an attached file from an ASP.NET project App_Data folder.
View 12 Replies
View Related
Sep 10, 2007
I am working on a Statistical Reporting system where:
Data Repository: SQL Server 2005
Business Logic Tier: Views, User Defined Functions, Stored Procedures
Data Access Tier: Stored Procedures
Presentation Tier: Reporting ServicesThe end user will be able to slice & dice the data for the report by
different organizational hierarchies
different number of layers within a hierarchy
select a organization or select All of the organizations with the organizational hierarchy
combinations of selection criteria, where this selection criteria is independent of each other, and also differeBelow is an example of 2 Organizational Hierarchies:
Hierarchy 1
Country -> Work Group -> Project Team (Project Team within Work Group within Country)
Hierarchy 2
Client -> Contract -> Project (Project within Contract within Client)Based on 2 different Hierarchies from above - here are a couple of use cases:
Country = "USA", Work Group = "Network Infrastructure", Project Team = all teams
Country = "USA", Work Group = all work groups
Client = "Client A", Contract = "2007-2008 Maint", Project = "Accounts Payable Maintenance"
Client = "Client A", Contract = "2007-2008 Maint", Project = all
Client = "Client A", Contract = allI am totally stuck on:
How to implement the data interface (Stored Procs) to the Reports
Implement the business logic to handle the different hierarchies & different number of levelsI did get help earlier in this forum for how to handle a parameter having a specific value or NULL value (to select "all")
(WorkGroup = @argWorkGroup OR @argWorkGrop is NULL)
Any Ideas? Should I be doing this in SQL Statements or should I be looking to use Analysis Services.
Thanks for all your help!
View 1 Replies
View Related
Jul 30, 2015
For each customer, I want to add all of their telephone numbers to a different column. That is, multiple columns (depending on the number of telephone numbers) for each customer/row. How can I achieve that?
I want my output to be
CUSTOMER ID, FIRST NAME, LAST NAME, TEL1, TEL2, TEL3, ... etc
Each 'Tel' will relate to a one or more records in the PHONES table that is linked back to the customer.
I want to do it using SELECT. Is it possible?
View 13 Replies
View Related
Dec 13, 2007
Hello:
I am running into an issue with RS2k PDF export.
Case: Exporting Report to PDF/Printing/TIFF
Report: Contains 1 table with 19 Columns. 1 column is static, the other 18 are visible at the users descretion. Report when printed/exported to pdf spans 2 pages naturally, 16 on the first page, 3 on the second, and the column widths have been adjusted to provide a perfect page span .
User A elects to hide two of the columns, and show the rest. The report complies and the viewable version is perfect, the excel export is perfect.. the PDF export on the first page causes every fith column, starting with the last column that was hidden to be expanded to take up additional width. On the spanned page, it renders the first column on that page correctly, then there is a white space gap equal to the width of the hidden columns and then the rest of the cells show with the last column expanded to take up the same width that the original 2 columns were going to take up, plus its width.
We have tried several different settings to see if it helps this issue or makes it worse. So far cangrow/canshrink/keep together have made no impact. It is not possible to increase the page size due to limited page size selection availablility for the client. There are far too many combinations of what the user can elect to show or hide to put together different tables to show and hide on the same report to remove this effect.
Any help or suggestion on this issue would be appreciated
View 1 Replies
View Related
Jul 20, 2005
The purpose, as you can probably guess, is to produce a set of sampledocuments from a large document run. The data row has a CLUB column and anIFC column; I want a set of samples that contains at least one of each CLUBand at least one of each IFC, but no more than necessary.Example schema and data:CREATE TABLE mDATA (ID INTEGER,CLUB CHAR(7),IFC CHAR(4));INSERT INTO mDATA (ID,CLUB,IFC) values (6401715,'AARPRAT','IC17')INSERT INTO mDATA (ID,CLUB,IFC) values (1058337,'AARPRAT','IC17')INSERT INTO mDATA (ID,CLUB,IFC) values (459443,'AARPPRT','IC25')INSERT INTO mDATA (ID,CLUB,IFC) values (4018210,'AARPBAS','IG21')INSERT INTO mDATA (ID,CLUB,IFC) values (2430656,'AARPBAS','IG21')INSERT INTO mDATA (ID,CLUB,IFC) values (6802081,'AARPPRD','IG29')INSERT INTO mDATA (ID,CLUB,IFC) values (4236511,'AARPPRD','IG29')INSERT INTO mDATA (ID,CLUB,IFC) values (2162104,'AARPBAS','IG21')INSERT INTO mDATA (ID,CLUB,IFC) values (2073679,'AARPPRD','IG29')INSERT INTO mDATA (ID,CLUB,IFC) values (8148891,'AARPBAS','IG21')INSERT INTO mDATA (ID,CLUB,IFC) values (1868445,'AARPBAS','IG21')INSERT INTO mDATA (ID,CLUB,IFC) values (6749213,'AARPBAS','IG21')INSERT INTO mDATA (ID,CLUB,IFC) values (8363621,'AARPPUP','IG29')
View 5 Replies
View Related
Jul 20, 2005
Hi All,I am new to Sql and I want to know if a given value lets say its 225is within ranges defined in the table.I have a table TblControl. Data type of both field is int.StartRange End Range0 100200 300500 600900 950(Sql server 2000 on window 2000)Thanks-Max
View 2 Replies
View Related
May 12, 2008
I have some data in week1 of the database and some data in week2 of the database. Now I want to add these both datas and put it in other column. Can I get exact SQL query for this??
View 6 Replies
View Related
Sep 21, 2006
I used to do this with classic asp but I'm not sure how to do it with .net.Basically I would take a table of Categories, Then I would loop through those. Within each loop I would call another stored procedure to get each item in that Category. I'll try to explain, Lets say category 2 has a player Reggie Bush and a player Drew Brees, and category 5 has Michael Vick, but the other categories have no items.Just for an example.. Category Table: ID Category1 Saints2 Falcons3 Bucaneers4 Chargers5 FalconsPlayer Table:ID CategoryID Player News Player Last Updated1 1 Reggie Bush Poetry in motion 9/21/20062 1 Drew Brees What shoulder injury? 9/18/20063 5 Michael Vick Break a leg, seriously. 9/20/2006 Basically I would need to display on a page:SaintsReggie BushPoetry in MotionFalconsMichael VickBreak a leg, seriously.So that the Drew Brees update doesnt display, only the Reggie Bush one, which is the latest.I have my stored procedures put together to do this. I just don't know how to loop through and display it on a page. Right now I have two datareaders in the code behind but ideally something like this, I would think the code would go on the page itself, around the html.
View 1 Replies
View Related
Jul 11, 2001
My table:
Table1
T1T2T3T4T5
---------------
abcde
How to query to have following result:
Table2
abcde
---------------
T1T2T3T4T5
T1T2T3T4T5
T1T2T3T4T5
T1T2T3T4T5
T1T2T3T4T5
Thanks in advance.
Janasha H
View 1 Replies
View Related
Jan 2, 2007
Can someone Please help me with what seems to me a "complex" query??
I have the following columns/data - See Original Data.jpg
This is what I need the SQL query(s) to do. I need it to
1) Select the distinct names AND months
2) Count the number of times that a name AND a month appeared together
3) Sum totalsold for each name/month
4) sum employeescore for each name/month
So it would look like - After Query.jpg
View 10 Replies
View Related
Mar 13, 2013
What are some good querys to run against a sample table of dates and items where the results can be used for charts?
Here is the sample table.
Code:
CREATE TABLE [dbo].[TestDates](
[ItemId] [int] IDENTITY(1,1) NOT NULL,
[AssignmentName] [nvarchar](max) NULL,
[AssignedDate] [date] NULL,
[DueDate] [date] NULL,
[Code] .....
View 1 Replies
View Related
May 13, 2008
Hi,
I have 3 tables:
Table SLA: SLA_code, SLA_name
Table industry: Industry_code, Industry_name
Table14: SLA_code_origin, SLA_code_destination, Industry_code, Freq
I would like to query to get in one table:
SLA_name for DESTINATION, Industry_name, Freq
Note: SLA_code contains the same codes as SLA_code_origin and SLA_code_destination. All are the same codes in column oringin means the From point and colum destination the To point.
How can I query to get the Freq and Industry for those destination SLAs?
I have make a relationship between:
Table SLA.SLA_code with Table14.SLA_code_destination and
Table_industry.Industry_code with Table14.Industry_code
But I am not sure if just a
SELECT SLA.SLA_name, Industry.Industry_name, Table14.Freq
FROM SLA, Industry, Table14
would select the SLA_destination and not the SLA_origin.
Thanks very much in advance,
Maria
View 1 Replies
View Related
Dec 29, 2006
I know this is no problem for anyone who has ever done a bit of programming in SQL, but for me it is a problem because I'm rather new in SQL. My question is: how to copy column in the same table in query? I need move one column to another and then to delete the first column (but not the whole column, just one part so I can't use Copy - Paste in Enterprise Manager). I know how to select the part that I want, all I need now is to copy columns.
Thank You all in advanced!
Sincerely,
Ivan
View 4 Replies
View Related
Apr 12, 2007
Hi, I have a query that gets the data for a specific week (starting Monday).
The below statement returns the data for the whole week mon-fri
What I would like to do is to have the data come back in a table with columns Mon,Tue,Wed etc breaking down the data.
How would I make the data come back by splitting it into columns mon,Subtot1,tue,Subtot1,wed,Subtot1,thur,Subtot1,fri,Subtot1
SELECT
dbo.People.FirstName,
dbo.People.LastName,
dbo.RequestTypes.Title,
dbo.Companies.CompanyName,
dbo.People.PersonId,
dbo.Actions.RequestId,
dbo.Actions.ActionDate,
dbo.Actions.TimeUsed As Subtot1
FROM
dbo.Actions
INNER JOIN dbo.Requests
INNER JOIN dbo.Companies ON
dbo.Requests.CompanyId = dbo.Companies.CompanyId ON
dbo.Actions.RequestId = dbo.Requests.RequestId
INNER JOIN dbo.RequestTypes ON
dbo.RequestTypes.RequestTypeId = dbo.Actions.RequestTypeId
INNER JOIN dbo.People ON
dbo.People.PersonId = dbo.Actions.ActionedById
WHERE
(dbo.People.PersonId = 'JO'
dbo.Actions.ActionDate > DATEADD(wk, DATEDIFF(wk,0,getdate()), 0) AND
dbo.Actions.ActionDate < DATEADD(wk, DATEDIFF(wk,0,getdate()), 5) )
GROUP BY
dbo.RequestTypes.Title,
dbo.People.FirstName,
dbo.People.LastName,
dbo.Companies.CompanyName,
dbo.People.PersonId,
dbo.Actions.RequestId,
dbo.Actions.ActionDate,
dbo.Actions.TimeUsed
Thanks in advance,
Tugsy
View 1 Replies
View Related
Dec 26, 2007
I just want to query all records with the maximum value in column invoices.numbers. So for instance I have records with invoice numbers = 850, 849, 800 respectively. I want only records 850 (the highest value). Then next month I want invoices with value 851. Anyone know how to write this easily so I don't have to write it out everytime, e.g. invoice.numbers=851?
View 3 Replies
View Related