Help Needed to Write Nim Game
I need help in writing the Nim game. I have the program written already for the user to select if they want to go first or the computer and how many stones the user wants to start with. The problem I am having is writing a loop that recognizes which player is to go first and executes the play of taking stones. Any help would be appreciated.
Perhaps there could be a boolean firstPlayerMove. Then, when the loop starts, if that is true then the first player enters the stones, otherwise second player. At the end of every time the loop is executed firstPlayerMove should equal "!firstPlayerMove."
Similar Messages
-
Help needed in writting Customer exit - ABAP Code
Hi Friends,
I have a scenario in one of the query and need to write a customer exit for the same. Here is the scenario:
I am using one input variable XXX to get input from user which feeds value to one of the charateristic lets say "CHAR1" in query. I have one more characteristic "CHAR2" which has to get the value from the same variable XXX. This is not allowed in BI7.0 as the variable is Hierarchy Node type. It gives error that "Variable XXX is used for two different characteristics."
So i need to create one more vaiable YYY which will get the value from XXX and then YYY will feed value to CHAR2. I would appreciate if some one could tell me step by step how to write customer exit and give me the piece of ABAP code i need to write in my case.
Your help will be appreciated in terms of points.
Thanks,
manmitHi Arun,
1. What should CHAR2 take - Hierarchy node variable or something else ?
--> CHAR2 is a simple charateristic
2. In your scenario - why have CHAR1 and CHAR2 ? why not have the user enter values against CHAR2 ??
--> We dont want user to enter two input as the input values for both Chars are same.
3. Did you try using a replacement path variable with the CHAR2 variable taking values from Variable on CHAR1 ?
--> In BI7.0 replacement path variable only take values from Query results. So not able to do the same.
Thanks -
Help needed to write control file.
Hi Guys,
i need to write one control file to upload data from .txt file to oracle table.
.txt file data contains like this
2006041110:40:22
2006041111:30:42
2006041210:40:22
i need to upload this data into date column in oracle table.
please help me to write control file for this requirement.
Thanks for your help and timedata1 "to_date(:data1, 'YYYYMMDDHH24:MI:SS')"
-
Help needed to write a dialog program
Hello ABAP Gurus,
I am very much new to ABAP Programming.
Can anybody help me to write a simple Dialog Program ??
I have a database table.
I have created a screen with screen painter, and kept some input fields & a push button in it.
I want to fill the database table with the data entered into the fields on the screen.
When the user enters the data and presses the PUSH BUTTON then that data record should be stored into the Database table.
So what kinda code I have to write in PAI (Process After Input), to achieve this functionality ??
The help will be greatly appreciated.
Thanks in advance
Best regards
Ravi
Edited by: Ravi Kiran on Oct 28, 2009 2:17 PMIt's easy:
In PAI you have do an insert into a database table, following the steps:
1.on PAI create a module: for exemple Zwrite_table.
2. inside Zwrite_table code as follow:
move var1 to wa_table-var1.
move var2 to wa_table-var2.
move var3 to wa_table-var3. etc etc
insert table ztable from wa_table.
P.s. ztable is a database table.
wa_table is a structure that have the same structure of ztable.
var1 var2 var3 etc is a variable inside your dynpro.
regards,
Roberto. -
Help Needed For Creating A Game
Hi, I recently decided to make a MMORPG.A game people will enjoy and have fun, I would of course keep it free sense I have play many games that cost 5-15 dollars a month.I have many creative ideas, but I need someone to show me the ropes and teach me how to use Java and i currently looking for a site to download it at.If anyone would care to teach me how to use this or would like to help me create this game(Medievil type game, Swords armor gold houses dragonslaying and plenty more) post here or send me a pm and we can talk more private.
I need:
*A site to download the best possiable Java console
*Helpful tutorial sites
*Or any other sites or tips you think i should know.
Extra Info On Me:
I dont know if this matters or not probably doesnt but I know how to handle and make a site, ive had some dbz rpgs back in the day(kinda rusty but i can manage).
Some more recent information:
I tried game maker and that doesnt seem to helpful.It would only be helpful if I played them 20 bucks which I am not going to do.
Also i am downloading now JS2E 5.0 for Java.
I am stilling waiting on some type of input or even a mentor.Hi there!
I'm not really a game programmer.. but here's some links anyway.
Someone pointed out this tutorial to me, and I think it is worthwhile:
http://fivedots.coe.psu.ac.th/~ad/jg/
It has stuff on Java 3D, networking, games for mobile phones/PDAs, isometric tile games, etc. It also has an appendix on loaders and Java Web Start.
Also, if you want to create 3D games, you might want to check out
http://www.3dcafe.com/asp/freestuff.asp
They have free 3D models in various formats.
For more 3D links and tutorials try:
http://www.3dlinks.com/
For a 3D tool, I like Anim8or. That it's free helps a lot ;)
http://www.anim8or.com/
And... ms paint!?! You will not be able to draw decent graphics with that. Adobe Photoshop Elements is a nice, low-cost program for 2D images.
There are lots of sites devoted to java game programming. Try the google. Love the google. Google is your friend. ;)
:) jen -
Help needed with creating Flash game
Hello,
I need to create Flash educational/quiz game for one of my clients. It would be based on concept like these ones for example:
Example 1
http://go.ucsusa.org/game/
Example 2
http://www.zdravlje.hr/igre/stop-aids/
Note: when you open this link you will see two text boxs which you first must fill. On the left side text box "Upišite ime" means "Type your name" and right one "Upišite godinu svog rođenja" means "Year of birth"
What is interesting about this type of games is that they are classic games (for example game Labirint where you have to find way out), but during play pop-up questions starts to appear to test end user knowledge abot certain topic (in example 2 topic is about AIDS/HIV). In case of my client, topic is about Eco environment.
Here is where my trouble starts;) : I found many useful free tutorials how to create simple flash game (most interesting example I found is this one http://www.strille.net/tutorials/snake/index.php) BUT I dont know how make that system of popup questions appear during game similar to Example 1 and Example 2?
Any help is appreciated and thanks in advance for promt reply.
Greetings,
AdnanUpdate: I have just read all instructions in Snake tutorial which helped be better realize how Snake game works.
a) This is what I plan to realize for my client:
1. Snake game which end users will play and during play pop-up/quiz quesions will appear on topic Eco environment;
2. For example when end user earns 50 points he must answer some of the random questions like "Q:How many ton of waste are produced by US livestock each year" with three answers A1: "1 milion" A2: "1 bilion" A3: "2 bilion" and after user scores 100 points then another question pops up and so on. This is all true if all answers are correct but in case he answer some question wrong than game can start from begining or another solution could be he looses -50 or -100 points.
3. At the end, user which gains most points wins.
b) This is what I have done till now:
I have this file http://www.strille.net/tutorials/snake/snakeGameWithHighscore.zip which I partly understand how it works with my Flash knowladge.
All functions and main game engine is in layer code:
"// Snake Game by Strille, 2004, www.strille.net
blockSize = 8; // the block width/height in number of pixels
gameHeight = 30; // the game height in number of blocks
gameWidth = 45; // the game width in number of blocks
replaySpeed = 1;
SNAKE_BLOCK = 1; // holds the number used to mark snake blocks in the map
xVelocity = [-1, 0, 1, 0]; // x velocity when moving left, up, right, down
yVelocity = [0, -1, 0, 1]; // y velocity when moving left, up, right, down
keyListener = new Object(); // key listener
keyListener.onKeyDown = function() {
var keyCode = Key.getCode(); // get key code
if (keyCode > 36 && keyCode < 41) { // arrow keys pressed (37 = left, 38 = up, 39 = right, 40 = down)...
if (playRec) {
if (keyCode == 37 && replaySpeed > 1) {
replaySpeed--;
} else if (keyCode == 39 && replaySpeed < 10) {
replaySpeed++;
} else if (game.onEnterFrame != undefined) { // only allow moves if the game is running, and is not paused
if (keyCode-37 != turnQueue[0]) { // ...and it's different from the last key pressed
turnQueue.unshift(keyCode-37); // save the key (or rather direction) in the turnQueue
} else if (keyCode == 32) { // start the game if it's not started (32 = SPACE)
if (!gameRunning || playRec) {
startGame(false);
} else if (keyCode == 80) { // pause/unpause (80 = 'P')
if (gameRunning && !playRec) {
if (game.onEnterFrame) { // pause
delete game.onEnterFrame; // remove main loop
textMC.gotoAndStop("paused");
} else { // exit pause mode
game.onEnterFrame = main; // start main loop
textMC.gotoAndStop("hide");
Key.addListener(keyListener);
function startGame(pRec) {
x = int(gameWidth/2); // x start position in the middle
y = gameHeight-2; // y start position near the bottom
map = new Array(); // create an array to store food and snake
for (var n=0;n<gameWidth;n++) { // make map a 2 dimensional array
map[n] = new Array();
turnQueue = new Array(); // a queue to store key presses (so that x number of key presses during one frame are spread over x number of frames)
game.createEmptyMovieClip("food", 1); // create MC to store the food
game.createEmptyMovieClip("s", 2); // create MC to store the snake
scoreTextField.text = "Score: 0"; // type out score info
foodCounter = 0; // keeps track of the number of food movie clips
snakeBlockCounter = 0; // keeps track of the snake blocks, increased on every frame
currentDirection = 1; // holds the direction of movement (0 = left, 1 = up, 2 = right, 3 = down)
snakeEraseCounter = -1; // increased on every frame, erases the snake tail (setting this to -3 will result in a 3 block long snake at the beginning)
score = 0; // keeps track of the score
ticks = lastRec = 0;
recPos = recFoodPos = 0;
playRec = pRec;
if (!playRec) {
textMC.gotoAndStop("hide"); // make sure no text is visible (like "game over ")
highscores.enterHighscoreMC._visible = false;
statusTextField.text = "";
recTurn = "";
recFrame = "";
recFood = "";
game.onEnterFrame = main; // start the main loop
} else {
if (loadedRecordingNumber != -1) {
var n = getLoadedRecordingNumberHighscorePos(loadedRecordingNumber);
statusTextField.text = "Viewing " + highscores[n].name.text + "'s game (score " + highscores[n].score.text + ")";
} else {
statusTextField.text = "Viewing your game";
game.onEnterFrame = replayMain; // start the main loop
placeFood("new"); // place a new food block
gameRunning = true; // flag telling if the game is running. If true it does not necessarily mean that main is called (the game could be paused)
function main() { // called on every frame if the game is running and it's not paused
if (playRec) {
if (ticks == lastRec+parseInt(recFrame.charAt(recPos*2)+recFrame.charAt(recPos*2+1), 36)) {
currentDirection = parseInt(recTurn.charAt(recPos));
lastRec = ticks;
recPos++;
} else if (turnQueue.length) { // if we have a turn to perform...
var dir = turnQueue.pop(); // ...pick the next turn in the queue...
if (dir % 2 != currentDirection % 2) { // not a 180 degree turn (annoying to be able to turn into the snake with one key press)
currentDirection = dir; // change current direction to the new value
recTurn += dir;
var fn = ticks-lastRec;
if (fn < 36) {
recFrame += " "+new Number(fn).toString(36);
} else {
recFrame += new Number(fn).toString(36);
lastRec = ticks;
x += xVelocity[currentDirection]; // move the snake position in x
y += yVelocity[currentDirection]; // move the snake position in y
if (map[x][y] != SNAKE_BLOCK && x > -1 && x < gameWidth && y > -1 && y < gameHeight) { // make sure we are not hitting the snake or leaving the game area
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x: x*blockSize, _y: y*blockSize}); // attach a snake block movie clip
snakeBlockCounter++; // increase the snake counter
if (map[x][y]) { // if it's a not a vacant block then there is a food block on the position
score += 10; // add points to score
scoreTextField.text = "Score: " + score; // type out score info
snakeEraseCounter -= 5; // make the snake not remove the tail for five loops
placeFood(map[x][y]); // place the food movie clip which is referenced in the map map[x][y]
map[x][y] = SNAKE_BLOCK; // set current position to occupied
var tailMC = game.s[snakeEraseCounter]; // get "last" MC according to snakeEraseCounter (may not exist)
if (tailMC) { // if the snake block exists
delete map[tailMC._x/blockSize][tailMC._y/blockSize]; // delete the value in the array m
tailMC.removeMovieClip(); // delete the MC
snakeEraseCounter++; // increase erase snake counter
} else { // GAME OVER if it is on a snake block or outside of the map
if (playRec) {
startGame(true);
} else {
gameOver();
return;
ticks++;
function replayMain() {
for (var n=0;n<replaySpeed;n++) {
main();
function gameOver() {
textMC.gotoAndStop("gameOver"); // show "game over" text
delete game.onEnterFrame; // quit looping main function
gameRunning = false; // the game is no longer running
enterHighscore();
function placeFood(foodMC) {
if (playRec) {
var xFood = parseInt(recFood.charAt(recFoodPos*3)+recFood.charAt(recFoodPos*3+1), 36);
var yFood = parseInt(recFood.charAt(recFoodPos*3+2), 36);
recFoodPos++;
} else {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]); // keep picking a spot until it's a vacant spot (we don't want to place the food on a position occupied by the snake)
if (xFood < 36) {
recFood += " "+new Number(xFood).toString(36);
} else {
recFood += new Number(xFood).toString(36);
recFood += new Number(yFood).toString(36);
if (foodMC == "new") { // create a new food movie clip
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
foodMC._x = xFood*blockSize; // place the food
foodMC._y = yFood*blockSize; // place the food
map[xFood][yFood] = foodMC; // save a reference to this food movie clip in the map
//- Highscore functions
loadHighscores();
enterHighscoreKeyListener = new Object();
enterHighscoreKeyListener.onKeyDown = function() {
if (Key.getCode() == Key.ENTER) {
playerName = highscores.enterHighscoreMC.nameTextField.text;
if (playerName == undefined || playerName == "") {
playerName = "no name";
saveHighscore();
Key.removeListener(enterHighscoreKeyListener);
Key.addListener(keyListener);
highscores.enterHighscoreMC._visible = false;
loadedRecordingNumber = -1;
startGame(true);
function enterHighscore() {
if (score >= lowestHighscore) {
highscores.enterHighscoreMC._visible = true;
highscores.enterHighscoreMC.focus();
Key.removeListener(keyListener);
Key.addListener(enterHighscoreKeyListener);
} else {
loadedRecordingNumber = -1;
startGame(true);
function getLoadedRecordingNumberHighscorePos(num) {
for (var n=0;n<10;n++) {
if (num == highscores[n].recFile) {
return n;
function loadHighscores() {
vars = new LoadVars();
vars.onLoad = function(success) {
for (var n=0;n<10;n++) {
var mc = highscores.attachMovie("highscoreLine", n, n);
mc._x = 5;
mc._y = 5+n*12;
mc.place.text = (n+1) + ".";
mc.name.text = this["name"+n];
mc.score.text = this["score"+n];
mc.recFile = parseInt(this["recFile"+n]);
lowestHighscore = parseInt(this.score9);
if (!gameRunning) {
loadRecording(random(10));
delete this;
if (this._url.indexOf("http") != -1) {
vars.load("highscores.txt?" + new Date().getTime());
} else {
vars.load("highscores.txt");
function loadRecording(num) {
vars = new LoadVars();
vars.onLoad = function(success) {
if (success && this.recTurn.length) {
recTurn = this.recTurn;
recFrame = this.recFrame;
recFood = this.recFood;
startGame(true);
} else {
loadRecording((num+1)%10);
return;
delete this;
loadedRecordingNumber = num;
if (this._url.indexOf("http") != -1) {
vars.load("rec"+loadedRecordingNumber+".txt?" + new Date().getTime());
} else {
vars.load("rec"+loadedRecordingNumber+".txt");
function saveHighscore() {
sendVars = new LoadVars();
for (var n in _root) {
if (_root[n] != sendVars) {
sendVars[n] = _root[n];
returnVars = new LoadVars();
returnVars.onLoad = function() {
if (this.status == "ok") {
loadHighscoresInterval = setInterval(function() {
loadHighscores();
clearInterval(loadHighscoresInterval);
}, 1000);
delete sendVars;
delete this;
sendVars.sendAndLoad("enterHighscore.php", returnVars, "POST");
function startClicked() {
if (!gameRunning || playRec) {
if (highscores.enterHighscoreMC._visible) {
Key.removeListener(enterHighscoreKeyListener);
Key.addListener(keyListener);
highscores.enterHighscoreMC._visible = false;
startGame(false);
function viewGame(lineMC) {
loadRecording(lineMC.recFile);
statusTextField.text = "Loading " + lineMC.name.text + "'s game...";
Now what is left to do is somehow to iclude educational quiz in this game/code. First idea that came to me is same thing Ned suggested: to create some unique movie clip which would contain all data/questions lined up but main problem for me is how to "trigger" that movie clip to play only AFTER end user clicks on "Start game" or SPACE to restart? Not sure how to solve this issue? -
HELP needed to write a function returning 1 record from join tables
Hi,
I would like to have some help to write a function so It can return 1 result.
I post my question in the APEX Express sextion but I think it's belong here.
Mount Points and Home Directory
Also, can I move a thread in another forum?
thanks
Roseline
Edited by: user8772975 on 2009-09-19 21:43ok, I think I started to understand the functions. But I still can't figured out
CONTEXT
We are scanning pages and images from different newspaper. All the .tif, .jpg are on DVDs.
I'm trying to build a search page who will allow for all DVDs and All images name related to the search result. Let say I search for:
FIGARO
I have this SQL query and I want to make a function that will return the same thing as:
select
"DOSSIER"."ID" as "DOSSIERID",
"DOSSIER"."TITLE" as "TITLE",
"DVD"."ID" as "DVDID",
"DVD"."NAME" as "DVDNAME",
"DVD"."ID_DOSSIER" as "DVD_ID_DOSSIER",
"ELEMENTS"."ID" as "ELEMENTSID",
"ELEMENTS"."NAME" as "ELEMENTSNAME",
"ELEMENTS"."ID_DVD" as "ELEMENTS_ID_DVD"
from "DOSSIER" "DOSSIER",
"DVD" "DVD",
"ELEMENTS" "ELEMENTS"
where "DVD"."ID_DOSSIER"="DOSSIER"."ID"
and "ELEMENTS"."ID_DVD"="DVD"."ID"
and "DOSSIER"."TITLE" = :P3_SEARCH
ORDER BY "DVD".NAMEBasiccly, We are scanning pages and images from different newspaper. All the .tif, .jpg are on DVDs.
So we have someting like that:
TITLE: FIGARO
DVD: C2008-203
Elements: 12l10201.tif, 12l10202.tif, 12l11101.tif, 12l11102.tif, 12l11201.tif
12l11202.tif, 12l12101.tif, 12l12102.tif
DVD C2008-204
Elements: 12l12202.tif, 12l13101.tif, 12l13102.tif, 12l13201.tif, 12l13202.tif,
12l14101.tif, 12l14102.tif, 12l14201.tif, 12l14202.tif, 12l15101.tif,
12l15102.tif, 12l15201.tif
DVD: C2008-205
Elements: 12l15202.tif, 12l16101.tif, 12l16102.tif, 12l16201.tif, 12l16202.tif,
12m01101.tif, 12m01102.tif, 12m01201.tifBased on what people on the forum told me, I now know that I have to use Pl/SQL so I have to write a function that will return the same thing as the prvious query.
Is that exact?
Based on this example,
[http://plsql-tutorial.com/plsql-functions.htm|http://plsql-tutorial.com/plsql-functions.htm]
I would write something like:
CREATE FUNCTION my_super_function
RETURN VARCHAR(2000);
IS
details VARCHAR(2000);
BEGIN
select
"DOSSIER"."ID" as "DOSSIERID",
"DOSSIER"."TITLE" as "TITLE",
"DVD"."ID" as "DVDID",
"DVD"."NAME" as "DVDNAME",
"DVD"."ID_DOSSIER" as "DVD_ID_DOSSIER",
"ELEMENTS"."ID" as "ELEMENTSID",
"ELEMENTS"."NAME" as "ELEMENTSNAME",
"ELEMENTS"."ID_DVD" as "ELEMENTS_ID_DVD"
from "DOSSIER" "DOSSIER",
"DVD" "DVD",
"ELEMENTS" "ELEMENTS"
where "DVD"."ID_DOSSIER"="DOSSIER"."ID"
and "ELEMENTS"."ID_DVD"="DVD"."ID"
and "DOSSIER"."TITLE" = :P3_SEARCH
RETURN details;
END;
/ And then, use soemthing like:
select my_super_function("DOSSIER"."ID") from "DOSSIER" "DOSSIER" where "DOSSIER"."TITLE" = :P3_SEARCHI'm kinda of lost. I spent the last 6 hours but I think that programming is a working progress.
Any hint would be appreciated,
thanks
Roseline -
Help needed to write in excel sheet
Hi,
I currently need to read a table and write it in a file.
iam able to do it by using UTL package.The utl file also writes in xls format.but if a record has two column.
both the columns are written in a single column in excel
sheet.Kindly suggest me how to solve this problem
Thanks in advance.1. spool a file with 'csv' extension using Sql*Plus.
2. Use a delimiter for columns.
For example,
select '"'||column1||'","'||column2||'"'
from mytable -
Help needed to write algorithm to find Direction given lat/lon
Hello, i need an algorithm to find out the direction being traveled given the starting and ending lat/lon decimal coordinates. Anybody have any clues how to do it? or where i can find one to just plug into my program? thanks for your help
public String getDirection(double prevLat, double prevLon, double newLat, double newLon) {
String direction;
return direction;
}Perhaps this helps:
http://www.cssd.ab.ca/tech/social/latitude/index.html
It will help you learn the meaning of lat/long-coords. I think you will end up with somthing like this:
if ( prevLat < newLat) {
//we are travelling north
else {
// we are travelling south
if (prevLong < newLong) {
//we are travelling east?
else {
//we are travelling west
}This could be wrong, since there is a west-long and an east-long..
Anyhow, hope this gets you on your way.
ps: is this a class-assignment?? -
Help needed to write download file program
I want to write a servlet which will allow clients to download files from server. Main work is, a fixed no.of downloads(only n users can have download permission) will be allowed at any time. if any more no.of new users came they have to wait for a download connection. if a connection is freed then that connection will be given to a user who had entered first. (First In First Out). Can it possible. Plz help me. Thanks in advance.
It's easy:
In PAI you have do an insert into a database table, following the steps:
1.on PAI create a module: for exemple Zwrite_table.
2. inside Zwrite_table code as follow:
move var1 to wa_table-var1.
move var2 to wa_table-var2.
move var3 to wa_table-var3. etc etc
insert table ztable from wa_table.
P.s. ztable is a database table.
wa_table is a structure that have the same structure of ztable.
var1 var2 var3 etc is a variable inside your dynpro.
regards,
Roberto. -
RE: Help needed w/ iPod Nano game issues
I have an 8GB 4th generation iPod nano, I've downloaded a game for it and cannot sync it to my iPod. The game shows up in my itunes library in the applications tab, but not were the games tab is. I also don't have a games tab under my iPod in the devices tab. I've tried to drag and drop,but to no avail,as well as manual and auto synchronizing. If anybody could help with this I'd greatly appreciate it.
Thnx R1PP3rJackwhat game is it?
some games aren't for the nano... just to make sure you downloaded one that's compatible, what's it called? -
Help need to write script min and group by
I want to see min first print date on last column for instance Wild Attire INc there should be 5/30/2014 for all records and for clear vision optical 2013/11/13 for all records belongs to clear vision optical integration name if only
one record then keep same like Qball 12/1/2014
select ISNULL(RQPPrintAmountQpYTD,0)+ISNULL(VLQPPrintAmountQpYTD,0) as [Qualified Volume 2014],isnull(PrintamountallYtd,0)+ISNULL(VLQPPrintamountALLYTD,0) as [Total Volume 2014], integration_id as [Integration ID], integration_name as [Integration Name], left([First Print Date],10) as [First Print Date] from #Po
Qualified Volume 2014
Total Volume 2014
Integration Name
First Print Date
0
1.93
Qball
12/1/2014
34446.98
277285.35
Wild Attire, Inc.
5/30/2013
522236.08
530125.78
Wild Attire, Inc.
8/22/2013
3861.06
40820.82
Wild Attire, Inc.
10/24/2014
2087.14
20783.46
Wild Attire, Inc.
10/30/2014
1296.95
24272.81
Wild Attire, Inc.
11/26/2014
1457.96
1512.71
Jackeez.com LLC
12/14/2013
15.27
37206.62
PrintingforLess.com
4/3/2014
9109.85
20631.28
M.A.I.L., Inc
12/16/2013
294.59
2278.32
B2SIGN, Inc.
11/17/2014
37.71
151.48
SpiralScout LLC
11/25/2014
93960.2
94110.38
Clear Vision Optical
11/13/2013
140349.03
140445.65
Clear Vision Optical
1/31/2014
14898.35
14898.35
Clear Vision Optical
3/18/2014
790.59
790.59
Clear Vision Optical
5/9/2014Hi MarkSubedi,
Your requirement has been extracted and formatted as below, correct me if there's anything wrong.
I want to see min first print date on last column. For instance Wild Attire INc,there should be 5/30/2014. And 2013/11/13 for all records belongs to clear vision optical integration name.If only one record then keep same like Qball 12/1/2014.
Based on my understanding, the below code can help to achieve your requirement.
DECLARE @Table TABLE
([Qualified Volume 2014] NUMERIC(18,2),
[Total Volume 2014] NUMERIC(18,2),
[Integration Name] VARCHAR(99),
[First Print Date] DATE
INSERT INTO @TABLE VALUES (0,1.93,'Qball','12/1/2014');
INSERT INTO @TABLE VALUES (34446.98,277285.35,'Wild Attire, Inc.','5/30/2013');
INSERT INTO @TABLE VALUES (522236.08,530125.78,'Wild Attire, Inc.','8/22/2013');
INSERT INTO @TABLE VALUES (3861.06,40820.82,'Wild Attire, Inc.','10/24/2014');
INSERT INTO @TABLE VALUES (2087.14,20783.46,'Wild Attire, Inc.','10/30/2014');
INSERT INTO @TABLE VALUES (1296.95,24272.81,'Wild Attire, Inc.','11/26/2014');
INSERT INTO @TABLE VALUES (1457.96,1512.71,'Jackeez.com LLC','12/14/2013');
INSERT INTO @TABLE VALUES (15.27,37206.62,'PrintingforLess.com','4/3/2014');
INSERT INTO @TABLE VALUES (9109.85,20631.28,'M.A.I.L., Inc','12/16/2013');
INSERT INTO @TABLE VALUES (294.59,2278.32,'B2SIGN, Inc.','11/17/2014');
INSERT INTO @TABLE VALUES (37.71,151.48,'SpiralScout LLC','11/25/2014');
INSERT INTO @TABLE VALUES (93960.2,94110.38,'Clear Vision Optical','11/13/2013');
INSERT INTO @TABLE VALUES (140349.03,140445.65,'Clear Vision Optical','1/31/2014');
INSERT INTO @TABLE VALUES (14898.35,14898.35,'Clear Vision Optical','3/18/2014');
INSERT INTO @TABLE VALUES (790.59,790.59,'Clear Vision Optical','5/9/2014');
;WITH CTE AS
SELECT [Integration Name],MIN([First Print Date]) [Min First Print Date],COUNT(1) cnt FROM @Table GROUP BY [Integration Name]
SELECT [Integration Name],CASE WHEN CNT=1 THEN T.[Qball Min First Print Date] ELSE [Min First Print Date] END [Min First Print Date] FROM CTE
CROSS APPLY (SELECT [Min First Print Date] AS [Qball Min First Print Date] FROM CTE WHERE [Integration Name]=N'Qball') AS T
ORDER BY CNT,[Integration Name]
In your case, the data seems from the the statement query in your post. If the statement is fine, the below query can be ready to use.
;WITH DataSrc AS
SELECT ISNULL(RQPPrintAmountQpYTD,0)+ISNULL(VLQPPrintAmountQpYTD,0) as [Qualified Volume 2014],isnull(PrintamountallYtd,0)+ISNULL(VLQPPrintamountALLYTD,0) as [Total Volume 2014], integration_id as [Integration ID], integration_name as [Integration Name], left([First Print Date],10) as [First Print Date] from #Po
CTE AS
SELECT [Integration Name],MIN([First Print Date]) [Min First Print Date],COUNT(1) cnt FROM DataSrc GROUP BY [Integration Name]
SELECT [Integration Name],CASE WHEN CNT=1 THEN T.[Qball Min First Print Date] ELSE [Min First Print Date] END [Min First Print Date] FROM CTE
CROSS APPLY (SELECT [Min First Print Date] AS [Qball Min First Print Date] FROM CTE WHERE [Integration Name]=N'Qball') AS T
ORDER BY CNT,[Integration Name]
By the way, there're some columns don't make any sense if what you'd like is just the min(First Print Date), you can remove them.
If you have any question, feel free to let me know.
Best regards,
Eric Zhang
TechNet Community Support -
Help Needed to write select statement
I have a table whose rows like this:
slno name testno
1 reni 1
2 arun 2
3 jithu 3
4 rajesh 4
5 shiju 1
6 Thomas 1
7 Thomas 2
8 Thomas 3
9 Thomas 4
many rows like above.I want to select names who have attended all the test that is testno 1,2,3,4
Looking forward to help from uMany ppl have given you solutions and suggestions. Did you try those?
Anyway, check whether this helps or not?
SQL> create table t as
2 select 1 slno,'reni' name, 1 testno from dual union all
3 select 2,'arun',2 from dual union all
4 select 3,'jithu',3 from dual union all
5 select 4,'rajesh',4 from dual union all
6 select 5,'shiju',1 from dual union all
7 select 6,'Thomas',1 from dual union all
8 select 7,'Thomas',2 from dual union all
9 select 8,'Thomas',3 from dual union all
10 select 9,'Thomas',4 from dual ;
Table created.
SQL> select * from t
2 where name in
3 (select name from t
4 group by name
5 having sum(decode(testno,1,1,2,1,3,1,4,1,0))=4);
SLNO NAME TESTNO
6 Thomas 1
7 Thomas 2
8 Thomas 3
9 Thomas 4
SQL> select slno,name,testno
2 from
3 (select slno,name,testno,count(1) over(partition by name) cnt from t)
4 where cnt =4;
SLNO NAME TESTNO
9 Thomas 4
6 Thomas 1
7 Thomas 2
8 Thomas 3
SQL> -
If i reset my ipad can i install paye games for free if i sign back into my apple ID. Please i need help because i need to update my games but i need to put in this billing thing and i want to get rid of it so then i cant buy games with my credit card
Hello,
As frustrating as it seems, your best to post any frustrations about the iPhone in the iPhone discussion here:
https://discussions.apple.com/community/iphone/using_iphone
As this discussion is for iBook laptops.
Best of Luck. -
I need help identifying an old Macintosh game: it was a painting game where you rode a roller coaster to an art museum and you got to pick what kind of art work you were going to make. It was animated, 2D i believe. This was the early 90's and I've been trying to hunt it down. I think there was some kind of animal in it, a giraffe maybe?
Could you be thinking of Microsoft Home's "Fine Artist" for Macintosh, as shown in this Amazon.com listing? This program was bundled with the Performa series of Macs during the mid-90s.
Maybe you are looking for
-
Why doesn't AS3 FileReference Download Work in IE/FF (Works fine in Chrome)
I am generating an Excel file with Java on the back-end and it seems to work just fine in Chrome but for whatever reason it doesn't in FF/IE. I have the very latest of Flash in each browser listed from this site: http://helpx.adobe.com/flash-player/k
-
Hi, I have a datagrid with image rendered in to it along with data. When the rowheight is increases the image size also increases. I need the image to be in its original size irrespective of what ever the row height is. I have attached the a scre
-
MWST not in SO but OK in Invoice.
Hello, Not sure what's wrong but my MWST won't come in to the sales order unless I go to the header and run "Update conditions" when its an item condition. Everything is in place 1 for customer 1 for MM, access sequence, condition records, pricing pr
-
Hi all I have configured work Flow for PO.I have activated work flow and task and have assigned agents to work flow and task. when i create PO first time it is going to inbox nd giving me a message "Please release PO". but when i create another PO th
-
Getting a Error when Configuring UWL in QAS Portal
Hi Experts, When I Configuring the UWL in System Admin-->Syetem Configuring -->UWL Administrator with the Administrator User I am getting the Error System SAP_SRM: Tue Feb 08 20:06:17 NZDT 2011 : No User mapping set up for user USER.PRIVATE_DATASOUR