Need help bout a query that will print data in matrix format..
solved
null
SQL> create table mytable
2 as
3 select 'pranita' consultant_name, 'manager' designation, 'sohan' salesman from dual union all
4 select 'pradeep', 'ceo', 'nick' from dual union all
5 select 'sham', 'developer', 'prasad' from dual union all
6 select 'john', 'designer', 'sohan' from dual union all
7 select 'sam', 'developer', 'rajesh' from dual union all
8 select 'pranita', 'manager', 'sohan' from dual union all
9 select 'john', 'designer', 'anand' from dual union all
10 select 'pradeep', 'ceo', 'rohit' from dual union all
11 select 'sam', 'developer', 'nick' from dual
12 /
Tabel is aangemaakt.
SQL> select consultant_name
2 , designation
3 , count(decode(salesman,'sohan',1)) "sohan"
4 , count(decode(salesman,'nick',1)) "nick"
5 , count(decode(salesman,'prasad',1)) "prasad"
6 , count(decode(salesman,'rajesh',1)) "rajesh"
7 , count(decode(salesman,'anand',1)) "anand"
8 , count(decode(salesman,'rohit',1)) "rohit"
9 from mytable
10 group by consultant_name
11 , designation
12 /
CONSULT DESIGNATI sohan nick prasad rajesh anand rohit
sam developer 0 1 0 1 0 0
john designer 1 0 0 0 1 0
pradeep ceo 0 1 0 0 0 1
sham developer 0 0 1 0 0 0
pranita manager 2 0 0 0 0 0
5 rijen zijn geselecteerd.Regards,
Rob.
Similar Messages
-
Need help with a workflow that will restrict resize to 720x540
I need help constructing a workflow that will resize any image I choose to 720x540. I want this to be restrictive to this size, in other words I don't want 720x468 or etc. I have tried this too many times, will no success so now I am reaching out for help. HELP. Once I have correct resized an image as needed I want to change its format and save a copy.
As always thanks for your reading and replying to my Post,
SebastianHi there,
what Image editing software do you have, if any ?
regards
Ric -
Need help with WMI code that will send output to db
'm new to WMI code writing, so I need some help with writing code that we can store on our server. I want this code to run when a user logs into their computer
and talks to our server. I also want the code to:
* check the users computer and find all installed patches
* the date the patches were installed
* the serial number of the users computer
* the computer name, os version, last boot up time, and mac address
and then have all this output to a database file. At the command prompt I've tried:
wmic qfe get description, hotfixid
This does return the patch information I'm looking for, but how do I combine that line of code with:
wmic os get version, csname, serialnumber, lastbootuptime
and
wmic nicconfig get macaddress
and then get all this to output to a database file?Thank you for the links. I checked out http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx and
found lots of good information. I also found a good command that will print information to a text file.
Basically what I'm trying to do is retrieve a list of all installed updates (Windows updates and 3rd party updates). I do like that the below code because it gives me the KB numbers for the Windows updates. I need this information so my IT co-workers &
I can keep track of which of our user computers need a patch/update installed and preferably which patch/update. The minimum we want to know is which patches / updates have been installed on which computer. If you wondering why we don't have Windows automatic
updates enable, that's because we are not allowed to.
This is my code so far.
#if you want the computer name, use this command
get-content env:computername
$computer = get-content env:computername
#list of installed patches
Get-Hotfix -ComputerName $computer#create a text file listing this information
Get-Hotfix > 'C:\users\little e\Documents\WMI help\PowerShell\printOutPatchList.txt'
I know you don't want to tell me the code that will print this out to a database (regardless if it's Access or SQL), and that's find. But maybe you can tell me this. Is it possible to have the results of this sent to a database file or do I need to go into
SQL and write code for SQL to go out and grab the data from an Excel file or txt file? If I'm understanding this stuff so far, then I suspect that it can be done both ways, but the code needs to be written correctly for this to happen. If it's true, then which
way is best (code in PowerShell to send information to SQL or SQL go get the information from the text file or Excel file)? -
Need help with an applet that will only run as an application
I am working on a slide show applet. The problem is that is won't run as an applet. I added a quite standard main method to stick the applet in a JFrame and this worked. I believe that the problem lies in how I am trying to open the files.
here are two of the methods that I believe contain part of the problem
private void showImage( String image_name )
image_file = Toolkit.getDefaultToolkit().getImage( image_name );
display_image.loadImage( image_file );
repaint();
private void setFileFolder( String folder )
file_finder = new File( folder );
file_results = file_finder.list();
}image_file is an object of class Image, display_image is an object of class ImageComponent (extends JComponent to draw an image), and file_finder and file_results are both objects of class File
I would greatly appreciate it if some one would help me with this.
The full source can be found at http://www.geocities.com/enchantedforest/3688/ImSP.zipOk. I got the image loading to work.
Now how do I fix the second method shown in my first post? It is needed to find all of the images in one specific folder so that the slide show can run. -
Need help writing a query that generates sequential tokens
Updated example to accomodate duplicates in cacard and to change the #temp_tokentable.cccard to varchar(20).
I am just having a block. I have a should be easy task, and have looked at it several ways, but cannot come up with some tsql that I would not be embarressed to show coworkers.
This is a the simplistic example of what needs to get done -
cacard table has credit cards. need to replace all credit cards with a generated token. the token is generated by just adding 1 to the lasttokenused and then + the right(creditcard, 4). Then the token and clear credit card values are inserted into
tokentable.
cacard can be a rather large table (# of rows and wide) in production so need to be as efficient as possible. But it is a onetime conversion program.
Thanks for any help
IF OBJECT_ID('tempdb..#Temp_cacard') IS NOT NULL
DROP TABLE #Temp_cacard
IF OBJECT_ID('tempdb..#Temp_tokentable') IS NOT NULL
DROP TABLE #Temp_tokentable
IF OBJECT_ID('tempdb..#Temp_lasttokenused') IS NOT NULL
DROP TABLE #Temp_lasttokenused
Create table #temp_cacard (ccard numeric(19,0))
Insert into #temp_cacard values (1234567891234567), (2344567890123456789),(3456789012345678900), (1234567891234567)
Create table #temp_tokentable (token varchar(20), ccard varchar(20))
Create table #temp_lasttokenused (token varchar(20))
Insert into #temp_lasttokenused values ('081111111111111111')
want to end up with
CACARD
08111111111111124567
08111111111111136789
0811111111111114890008111111111111124567
tokentable
08111111111111124567 1234567891234567
08111111111111136789 2344567890123456789
08111111111111148900 3456789012345678900
lasttokenused
0811111111111114Thought that I would post the code that reads a credit card number file and replaces card numbers
with token values. The tokens keep the last 4 of the original credit card number. I have two example card number tables. One table -cacardn - has a numeric(19,0) card number and the other - cacardv - has a varchar(20) card
number. My shop has credit card numbers defined as both. Obviously, another step after this runs is to encrypt the #token.data column.
IF OBJECT_ID('tempdb..#cacardn')IS NOT NULL
DROP TABLE #cacardn;
IF OBJECT_ID('tempdb..#cacardv')IS NOT NULL
DROP TABLE #cacardv;
IF OBJECT_ID('tempdb..#Token')IS NOT NULL
DROP TABLE #Token;
IF OBJECT_ID('tempdb..#Temp_Token')IS NOT NULL
DROP TABLE #Temp_Token;
IF OBJECT_ID('tempdb..#LastToken')IS NOT NULL
DROP TABLE #LastToken;
-- cardnumber table that has numeric (19,0) card numbers
Create Table #cacardn ([cccard] numeric(19,0))
INSERT INTO #cacardn ([cccard]) VALUES
(NULL),
(0),
(1111),
(91111111111121112),
(1111),
(1113),
(91111111111201120);
-- carnumber table that has varchar(20) card numbers
Create Table #cacardv ([cccard] varchar(20))
INSERT INTO #cacardv ([cccard]) VALUES
(NULL),
('0'),
('00000000000000001111'),
('00091111111111121112'),
('00000000000000001111'),
('00000000000000001113'),
('00091111111111201120');
-- token table that has tokens, varbinary card numbers, data type (13-20) are card numbers
Create Table #Token (
[token] varchar(20),
[data] varbinary(256),
[type] int)
INSERT INTO #Token ([token],[data],[type]) VALUES
('00000000000000000000', CAST('00000000000000000000' as varbinary), 13),
('', CAST('' as varbinary), 13),
('0', CAST('0' as varbinary), 13),
('00091111111111111111', CAST('00000000000000001111' as varbinary), 13),
('00091111111111121112', CAST('00000000000000001112' as varbinary), 14),
('00091111111111201120', CAST('00000000000000001120' as varbinary), 20)
-- Temporary, Intermediate table
CREATE TABLE #Temp_Token(ClearValue varchar(128));
SELECT * INTO #LastToken from (
SELECT '0009111111111150') d (lastgeneratedToken)
-- Create an entry in the Temp_Token table for entries in the card number field that do not match the Token table token or
-- Token table data values. These must be card number clear values.
-- ++ change from #cacardv to #cacardv to test both numeric and varchar card numbers
-- ++ the card number field must not NULL, not = 0 and numberic values
INSERT INTO #Temp_Token
SELECT DISTINCT cccard
FROM #cacardv l
WHERE cccard IS NOT NULL and CAST(cccard as varchar) <> '0' and CAST(cccard as varchar) not like '%[^0-9]%' and
NOT EXISTS (SELECT 1 FROM #Token s
WHERE (right('00000000000000000000'+ rtrim(cccard), 20) = [token] or
CAST(right('00000000000000000000'+ rtrim(cccard), 20) as varchar) = CAST([data] as varchar)) and
[type] in (13,14,15,16,20))
DECLARE @lastgeneratedToken varchar(20) = (SELECT lastgeneratedToken from #LastToken)
-- Update the last token used
UPDATE ifs_EDLastTokenUsed
SET EDToken = RIGHT('0000000000000000' + CAST(@lastgeneratedToken + CAST(@@RowCount AS numeric)AS varchar), 16);
-- Insert into the Token table
INSERT INTO #Token
SELECT DISTINCT RIGHT('0000000000000000' + CAST(@lastgeneratedToken + ROW_NUMBER() OVER (ORDER BY ClearValue) AS varchar(20)) + RIGHT(ClearValue,4), 20),
CAST(RIGHT('0000000000000000' + ClearValue, 20) as varbinary), 13
FROM #Temp_Token
-- Now Update the card number field that matches the Token data field with the Token token field.
-- ++ change from #cacardv to #cacardv to test both numeric and varchar card numbers
-- ++ Do not undate NULL, 0, or non-numeric card numbers (they are invalid values)
UPDATE c
SET c.cccard = s.[token]
FROM #cacardv c inner join (SELECT DISTINCT cccard, Cast([token] as varchar) as [Token]
FROM #cacardv l inner join #Token s
ON RIGHT('0000000000000000' + CAST(l.cccard as varchar), 20) = CAST(s.[Data] as varchar)
WHERE [type] in (13,14,15,16,20)) s
on c.cccard = s.cccard
WHERE c.cccard IS NOT NULL and CAST(c.cccard as varchar) <> '0' and CAST(c.cccard as varchar) not like '%[^0-9]%'
-- Check the Results
select * from #cacardv
Any comments or suggestions would be appreciated. (this is not the exact code. but the main statements are represented.)
Wonder about my WHERE clauses that seek to exclude junk data (IS NOT NULL, <> '0', and numeric only data), shhould the WHERE close be on the inner or outer WHERE? -
I need help creating a formula that looksup cell data and give a value.
I want to have the table "At a glance" show the total days a driver has worked, there total in sales and there total in milage. The table shown is a example of what I want to have happen. I want to input any name into cell B2,C2,D2,ect. that is found in the row C2:C17 of Checkpoint (Truck 1) and Checkpoint (Truck 2) and return the total amount of day the driver has driven both trucks, The total in sales the driver has collected (Truck 1 and 2) and How many miles the driver has driven (Truck 1 and 2). I realize that these tables are not labeled correct. If I enter a name into B2 and the driver associated with that name hasnt driven then I want "N/A' to show in cell B2 and so one. I assume that the formula that is created for cell B2 will be copied and pasted into cell C2, D2, ect..
If someone could help me with this problem I'd really appreciate it.
Thanks.Hi br,
To show the number of days worked by a driver, you need to COUNT the number of times that driver's name appears in row 2 of both tables.
To calculate his total sales and total mileage, you need to SUM the amounts he brought in each day and the distances he drove each day.
Your functions for this are COUNTIF and SUMIF.
Formulas in At a Glance:
B2: =COUNTIF(Truck 1 :: $3:$3,B$1)+COUNTIF(Truck 2 :: 3:3,B$1)
B3: =SUMIF(Truck 1 :: $3:$3,B$1,Truck 1 :: $5:$5)+SUMIF(Truck 2 :: $3:$3,B$1,Truck 2 :: $5:$5)
B4: =SUMIF(Truck 1 :: $3:$3,B$1,Truck 1 :: $12:$12)+SUMIF(Truck 2 :: $3:$3,B$1,Truck 2 :: $12:$12)
Fill all three formulas right to the last column of At a Glance.
To put N/A in place of the 0 in Roger's column and the empty columns, wrap each of the formulas in an IF statement:
Bn: =IF(AND(ISERROR(MATCH(B$1,Truck 1 :: $3:$3,0)),ISERROR(MATCH(B$1,Truck 2 :: $3:$3,0))),"N/A",formula)
Where formula is the formula used in column B above.
Regards,
Barry -
Need help with a query- working around bad data
We have a table called B3OWNERS, with fields called Owner_Full_Name and B1_Primary_owner (which is either 'Y' or 'N'). Normally I want to pull the owner_full_name when b1_primary_owner = 'Y', but some have multiple owners with none flagged primary. I have tried the following CASE under the SELECT, but it pulls the 'N' rows before the 'Y' row. I need it to pull only the primary owner, if one is flagged, otherwise just one owner if it is not flagged.
CASE
WHEN b3o.b1_primary_owner = 'Y'
THEN B3O.B1_OWNER_FULL_NAME
ELSE B3O.B1_OWNER_FULL_NAME
END OWNER,
Thanks in advance.Since you have not provided sample data and expected output so I'm guessing this is what you want to do:
with t as (
select 'John Dow' Owner_Full_name, 'Y' B1_Primary_owner from dual
union all
select 'John Dow' Owner_Full_name, 'N' B1_Primary_owner from dual
union all
select 'Josef Dow' Owner_Full_name, 'Y' B1_Primary_owner from dual
union all
select 'Josef Dow' Owner_Full_name, null B1_Primary_owner from dual
union all
select 'Josef Dow' Owner_Full_name, null B1_Primary_owner from dual
union all
select 'Jack Dow' Owner_Full_name, 'Y' B1_Primary_owner from dual
union all
select 'Jina Dow' Owner_Full_name, 'N' B1_Primary_owner from dual
union all
select 'Julia Dow' Owner_Full_name, null B1_Primary_owner from dual)
SELECT OWNER_FULL_NAME, B1_Primary_owner
FROM (
select OWNER_FULL_NAME, B1_Primary_owner,
ROW_NUMBER() OVER (PARTITION BY Owner_Full_name ORDER BY B1_Primary_owner) ROW_NUM
from t
where B1_Primary_owner != 'N'
OR B1_Primary_owner IS NULL)
WHERE ROW_NUM = 1;
OWNER_FUL B
Jack Dow Y
John Dow Y
Josef Dow Y
Julia Dow -
Need help writing a query for following scenario
Hi all, I need some help writing a query for the following case:
One Table : My_Table
Row Count: App 5000
Columns of Interest: AA and BB
Scenario: AA contains some names of which BB contains the corresponding ID. Some
names are appearing more than once with different IDs. For example,
AA BB
Dummy 10
Me 20
Me 30
Me 40
You 70
Me 50
Output needed: I need to write a query that will display only all the repeating names with their corresponding IDs excluding all other records.
I would appreciate any input. ThanksIs it possible to have a records with the same values for AA and BB? Are you interested in these rows or do you only care about rows with the same value of AA and different BB?
With a slight modification of a previous posting you can only select those rows that have distinct values of BB for the same value of AA
WITH t AS (
SELECT 'me' aa, 10 bb FROM dual
UNION ALL
SELECT 'me' aa, 20 bb FROM dual
UNION ALL
SELECT 'you' aa, 30 bb FROM dual
UNION ALL
SELECT 'you' aa, 30 bb FROM dual
SELECT DISTINCT aa, bb
FROM (SELECT aa, bb, COUNT(DISTINCT bb) OVER(PARTITION BY aa) cnt FROM t)
WHERE cnt > 1; -
Need help writing a MySQL query that will return only records with matching counter-parts
Since I don't know how to explain this easily, I'm using the
table below as an example.
I want to create a MySQL query that will return only records
that have matching counter-parts where 'col1' = 'ABC'.
Notice the 'ABC / GHI' record does not have a
counter-matching 'GHI / ABC' record. This record should not be
returned because there is no matching counter-part. With this
table, the 'ABC / GHI' record should be the only one returned in
the query.
How can I create a query that will do this?
id | col1 | col2
1 | ABC | DEF
2 | DEF | ABC
3 | ABC | GHI
4 | DEF | GHI
5 | GHI | DEF
*Please let me know if you have no idea what I'm trying to
explain.AngryCloud wrote:
> Since I don't know how to explain this easily, I'm using
the table below as an
> example.
>
> I want to create a MySQL query that will return only
records that have
> matching counter-parts where 'col1' = 'ABC'.
>
> Notice the 'ABC / GHI' record does not have a
counter-matching 'GHI / ABC'
> record. This record should not be returned because there
is no matching
> counter-part. With this table, the 'ABC / GHI' record
should be the only one
> returned in the query.
>
> How can I create a query that will do this?
>
>
> id | col1 | col2
> --------------------
> 1 | ABC | DEF
> 2 | DEF | ABC
> 3 | ABC | GHI
> 4 | DEF | GHI
> 5 | GHI | DEF
>
>
> *Please let me know if you have no idea what I'm trying
to explain.
>
Please be more clear. You say that 'ABC / GHI' should not be
returned,
and then you say that 'ABC / GHI' should be the only one
returned. Can't
have both... -
Need Help Writing a Query.
OK, i have been trying to write a query now and have gone in several different directions and find myself stuck back at square one and was hoping someone could help me out.
Here is my issue and i'll try to explain as best as i can.
Example: i have the following data.
Desc 1 --- Instruct 1 --- 2/2/2009
Desc 1 --- Instruct 1 --- 2/7/2009
Desc 1 --- Instruct 1 --- 2/3/2009
Desc 1 --- Instruct 2 --- 2/5/2009
Desc 2 --- Instruct 1 --- 2/3/2009
Desc 2 --- Instruct 1 --- 2/1/2009
What i need to do is write a query that will show distinct Descriptions as well as distinct instructions. (Example, Desc 1 could have 7 different instructions, so i would need 7 different lines for Desc 1, with the most recent date and a count for how many occurances of each specific instruction, for each specific Description for each of the 7 lines for Desc 1.
Example of results would be like this
Desc 1 --- Instruct 1 --- 2/7/2009 --- 3
Desc 1 --- Instruct 2 --- 2/5/2009 --- 1
Desc 2 --- Instruct 1 --- 2/3/2009 --- 2
Hopefully that is enough information, but if anything else is needed for me to provide in order to get some help, just let me know and i will do my best to get that information.
thanks in advanceFrank Kulash wrote:
Hi,
SELECT description
, instruction
, MAX (dt) AS most_recent
, COUNT (*) AS total_num
FROM table_x
GROUP BY descrrption
, instruction;"GROUP BY x, y" means the output will contain one row for every distinct combination iof x and y that occurs in the results.
All the columns in the SELECT BY clause must be
(a) in the GROUP BY clause,
(b) aggregate functions (like MAX or COUNT), or
(c) trivially dependant on (a) or (b) (for example: UPPER (description))Thank you;
I think i was trying to over complicate things.
So simple, yet so very effective
thanks again -
Need help with conditional query
guys this is just an extension of this post that Frank was helping me with. im reposting because my requirements have changes slightly and im having a hell of a time trying to modify the query.
here is the previous post.
need help with query that can look data back please help.
CREATE TABLE "FGL"
"FGL_GRNT_CODE" VARCHAR2(60),
"FGL_FUND_CODE" VARCHAR2(60),
"FGL_ACCT_CODE" VARCHAR2(60),
"FGL_ORGN_CODE" VARCHAR2(60),
"FGL_PROG_CODE" VARCHAR2(60),
"FGL_GRNT_YEAR" VARCHAR2(60),
"FGL_PERIOD" VARCHAR2(60),
"FGL_BUDGET" VARCHAR2(60)
)data
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');
I need to find the greatest grant year for the grant by a period parameter.
once i find the greatest year i need to check the value of period 14 for that grant for the previous year and add it to the budget amount for that grant. however if their is an entry in the greatest year for period 00 then i need to ignore the period 14 of previous year and do this calculation current period +(current period - greatest year 00)
hope that makes sense so in other words with the new data above. if i was querying period two of grant year 11. i would end up with $800
because the greatest year is 11 it contains a period 0 with amount of $400 so my total should be
period 2 amount $ 600
period 0 amount $ 400 - period 2 amount of $600 = 200
600+200 = $800
if i query period 1 of grant 360055 i would just end up with 800 of grnt year 10.
i have tried to modify that query you supplied to me with no luck. I have tried for several day but im embarrased to say i just can get it to do what im trying to do .
can you please help me out.
here is the query supplied by frank kulash who gracefully put this together for me.
WITH got_greatest_year AS
SELECT fgl.* -- or whatever columns are needed
, MAX ( CASE
WHEN fgl_period = :given_period
THEN fgl_grnt_year
END
) OVER () AS greatest_year
FROM fgl
SELECT SUM (fgl_budget) AS total_budget -- or SELECT *
FROM got_greatest_year
WHERE ( fgl_grnt_year = greatest_year
AND fgl_period = :given_period
OR ( fgl_grnt_year = greatest_year - 1
AND fgl_period = 14
;MiguelHi, Miguel,
Are you waying that, when the greatest year that has :given_period also has period='00' (or '0', or whatever you want to use), then you want to double the budget from the given_period (as well as subtract the budget from the '00', and not count the pevious year's '14')? If so, add another condition to the CASE statement which decides what you're SUMming:
WITH got_greatest_year AS
SELECT TO_NUMBER (fgl_grnt_year) AS grnt_year
, fgl_period
, TO_NUMBER (fgl_budget) AS budget
, MAX ( CASE
WHEN fgl_period = :given_period
THEN TO_NUMBER (fgl_grnt_year)
END
) OVER () AS greatest_year
FROM fgl
, got_cnt_00 AS
SELECT grnt_year
, fgl_period
, budget
, greatest_year
, COUNT ( CASE
WHEN grnt_year = greatest_year
AND fgl_period = '00'
THEN 1
END
) OVER () AS cnt_00
FROM got_greatest_year
SELECT SUM ( CASE
WHEN grnt_year = greatest_year -- New
AND fgl_period = :given_period -- New
AND cnt_00 > 0 THEN budget * 2 -- New
WHEN grnt_year = greatest_year
AND fgl_period = :given_period THEN budget
WHEN grnt_year = greatest_year
AND fgl_period = '00' THEN -budget
WHEN grnt_year = greatest_year - 1
AND fgl_period = '14'
AND cnt_00 = 0 THEN budget
END
) AS total_budget
FROM got_cnt_00
;You'll notice this is the same as the previous query I posted, except for 3 lines maked "New". -
Can I create an action that will print to a specific printer?
Hi all,
Simple question. I want to create two buttons. One that will print a form to printer 1 (a work printer) and one button that will print to printer 2 (OneNote printer, aka Send to OneNote).
Is that possible? No extra options needed, just a quick print.With the JavaScript doc.print method: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.511.html
you can include the printer you want in the printParams object: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1007.html -
HP Printer that will print on 10 point synthetic paper
Hello,
I'm looking for a printer that will print on 10 point synthetic paper. This paper is resistant to absorbing water and fading in the sun. (greenhouse application)
Does HP have a printer that will print on paper like this that uses waterproof toner or ink?
Thank you,
SheldonI don't know of any printers that can handle that size. How does the card stock come? As individual cards or grouped together in larger sheets that you cut apart or tear apart?
Can your printer successfully grab and move those cards thru it? If so create the card design in the upper left hand corner of an 8.5 x 11 layout and print to the borderless letter size paper size selection for you printer. For that you would need a 3rd party image editor that supports layers or Pages, which will do the job nicely.
Some Image Editors That Support layers:
Photoshop Elements 11 for Mac - $79
GraphicConverter - $40
Rainbow Painter - $30
Imagerie - $38
Acorn - $50
Pixelmator - $60
Seashore - Free
GIMP for Mac - Free -
Need Help on below Query.
Hi All,
Need Help on below Query.
Consider,
"test9" Table Data in COLUMN "Name" AS
Name
=====
'a'
'b'
'c'
'd'
'e'
I am writing a query as :
SELECT * FROM test9 WHERE Name IN ('a','b','c','d','e','f','g')
I want result set as , It should show data as -
'f'
'g'
i.e. data which does not exists in the table and which is give in in clause
Is it possible in a single query.You can put the data that is to be checked for into a table instead or an inline view, for example:
with t as
(select 'a' as c1 from dual
union all
select 'b' from dual
union all
select 'c' from dual
union all
select 'd' from dual
union all
select 'e' from dual)
select c1 from (select 'a' as c1 from dual
union all
select 'b' from dual
union all
select 'c' from dual
union all
select 'd' from dual
union all
select 'e' from dual
union all
select 'f' from dual
union all
select 'g' from dual)
minus
select c1 from t
C
f
g
2 rows selected. -
I need help writing a script that finds the first instance of a paragraph style and then changes it
I need help writing a script that finds the first instance of a paragraph style and then changes it to another paragraph style. I don't necessarily need someone to write the whole thing, by biggest problem is figuring how to find just the first instance of the paragraph style. Any help would be greatly appreciated, thanks!
Hi,
Do you mean first instance of the paragraph style
- in a chosen story;
- on some chosen page in every text frames, looking from its top to the bottom;
- in a entire document, looking from its beginning to the end, including hidden layers, master pages, footnotes etc...?
If story...
You could set app.findTextPreferences.appliedParagraphStyle to your "Style".
Story.findText() gives an array of matches. 1st array's element is a 1st occurence.
so:
Story.findText()[0].appliedParagraphStyle = Style_1;
//==> this will change a paraStyle of 1st occurence of story to "Style_1".
If other cases...
You would need to be more accurate.
rgds
Maybe you are looking for
-
Good Morning My sister (removed) and I spoke with you about a week ago concerning a credit for a returned Garmin Vivofit fitness tracker that was ordered online, returned to a store and the store shipped it to your online order returns facility. Jus
-
Calc performance on new machine
We are migrating from 5.02 patch 13a to 6.5 over the next month. As a part of this migration we have moved to a new Unix server, with faster processors. The move changes OS from 11.0 to 11.i. We are seeing calc times INCREASE dramatically, with inter
-
EBS 12.0.6 Upgrade to 12.1.1 Error
Hi all, I'm on the midst of applying the patchset 7303030. At the end of the patch, I seen this error message saying: The following Oracle Forms objects did not generate successfully: fv forms/US FVXBEDBD.fmx Hope someone can help me. OS
-
Multi-Site WAN With Centralized Call Manager
The customer has HQ with 15 Branches. Head quarter has about 4300 Phones, and Branches has: Branch 1 = 420 Branch 2 = 256 Branch 3 = 385 Brnach 4 = 298 Branch 5 = 262 Branch 6 = 171 Branch 7 = 200 Branch 8 = 97 Branch 9 = 198 Branch 10 = 254 Branch 1
-
We want to create documents for Adobe Readers that anyone can open without font substitution. According to Adobe's documentation there is suppose to be standard built-in fonts so we do not need to embed fonts or risk substitution. I can not find this