Query Help Please
Hi... having problems with a query. Any assistance would be
much appreciated.
Two queries with identical columns: Villages_Query_1 and Villages_Query_2.
Both have these columns: Village_ID, Village_Name, Player_ID.
I need to find all records in Villages_Query_2 where the Village_ID's match but the Player_ID's have changed.
Example Village_Query_1
Village_ID
Village_Name
Player_ID
1
Houston
1
2
Dallas
2
3
Chicago
3
Example Village_Query_2
Village_ID
Village_Name
Player_ID
1
Houston
1
2
Phoenix
4
3
Chicago
3
4
New York
5
In this case, Village_ID = 2, has changed names (Dallas to Phoenix) and the Player_ID has changed (2 to 4). In addition, a new record was added.
The eventual output I need is to be able to report the following:
Player 2 village "Dallas" was taken by Player 4 and renamed "Phoenix".
New York is a new village owned by Player 5.
How the heck do I do this?? I have been trying query after query... reading about query of queries and JOINS and and and... I am now completely confused.
Help appreciated.
Mark
Well... firstly... you do not use MS Access for that volume of data. Plain and simple. MS Access is for DBs like "My CD collection". It's a desktop application, and is not intended to be used other than as a desktop application.
Part of the reason for it not being appropriate for the job is that it can't do things like bulk loading data, which is kinda what you're wanting to do here. That aside, it's a single-user file-based DB which is simply not designed to work as the back-end for a web application (or any sort of serious application).
Anyway, I would approach this by putting all the data from the CSV files into the DB as is. Then on the DB run a query which gets all your changes. You're really going to struggle with the suggestions here to use valueList() to generate a list that is then used for a NOT IN(#list here#), because you're likely to have a mighty long list there. Even proper DBs like Oracle only allow 2000 entries in a list like that (SQL Server is about the same, from memory), so I doubt QoQ will allow even that. The reason the DBs put limits on these things is that doing a WHERE IN (#list#) is a really poorly-performing process.
If you've got all your data in the DB, then your query becomes pretty easy, and I'm sure even Access could cope with it. it'd be something like this:
SELECT VB.village_id, VB.village_name AS village_old_name, VB.player_id AS player_old_id,
VU.village_id AS village_new_id, VU.village_name AS village_new_name, VU.player_id as player_new_id
FROM villages_base VB
RIGHT OUTER JOIN villages_updates VU
ON VB.village_id = VU.village_id
WHERE VB.village_name != VU.village_name
(that's untested and I only gave it about 1min thought before typing it in, so don't quote me on that!)
Where VILLAGE_BASE is your original data, and VILLAGE_UPDATES is the data that indicates the changes. I'm kinda guessing that this is the sort of thing you want. Note: the "new" villages will be the ones which have NULLs for the village_id, village_old_name and player_old_id.
Getting all the data into the DB is going to be a matter of looping over the CSV file and doing an INSERT for each row. And that will take as long as it takes, so you might need to get some control over your request timeouts. However doing these inserts will take less time than all the QoQ logic suggested before, so you might be OK. And the query should be quick.
What happens to the data once the report is written? Does the "updated" data become the "live" data? If so, after you run your report you're gonna want to do something like a TRUNCATE on villages_base, and INSERT all the records from villages_update into it (then TRUNCATE villages_update, ready for the next time you need to run this process). Although don't take my word for it here, as I'm guessing your requirement here ;-)
Adam
Similar Messages
-
Pass username and password ADFS without using query string, Please help.
pass username and password ADFS without using query string, Please help.
I used query string , but it is unsecured to pass credentials over url, with simple tool like httpwatch , anyone can easily get the password and decrypt it.Hi,
According to your post, my understanding is that you had an issue about the ADFS.
As this issue is related to ADFS, I recommend you post your issue to the forum for ADFS.
http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=Geneva
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
Thank you for your understanding and support.
Thanks,
Jason
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Jason Guo
TechNet Community Support -
Query Help:
http://forum.java.sun.com/thread.jsp?forum=45&thread=471180&tstart=15&trange=15
It seems I have confused enough people with my improper presentation of query. Sorry guys. I will restate my question with different table names.
The above was my previous posting, which was not clear..so Iam restating my problem as follows....
I have the following tables
Customer(custID, Name, Address)
Order(custID, OrderID, orderDate)
CreditCard(custID, creditCard#, creditCardType)
Now if I have 3 records in Order with custID 100 and 2 records in CreditCard as
Order:
100,A001,11/22/03
100,A002,11/24/03
100,A003,12/02/03
CreditCard:
100,42323232..., VISA
100,5234234...., MASTER
Now how can I get
custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
data in minimum no. of records....
I think I have made my query clear..
now please help me guys...
thanks so much for your help.You are right.
But frankly the actual tables on my database are not customer,orders and creditcards..but I just tried to reproduce the problem with these tables, please ignore that user needs a refund etc situtaion. If the tables were actually order,creditcards etc..it would have been a problem to be considered.
Can you please help me with the query
if I have m rows in Order and n rows in CreditCard. I will get m*n records, I looking for max(m,n).
With the following fields in my query result,
custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
from Customer, Order, CreditCard tables
Thanks so much for your htlp -
Help please deploying Crystal Decisions 10 to Microsoft 2008 R2 IIS 7
Folks, I need your help please. We've been using Crystal Decisions 10 with MS Server 2003. We're migrating to a VM envirionment with MS Server 2008 R2. I have everything working except for our crystal reports. We are a mostly an ASP Classic enviroment.
When the report is called it opens, the SP query does not fail but the data does not show in the activex viewer. If there is a tree view associated with the report, you can see the expandable data points on the left but the report does not actually appear. No errors are apparent either.
This thing is killing my production. Any help would be greatly appreaciated!Hi Jack
I moved your post to the SAP Crystal Reports - Legacy SDKs SCN Space.
I really doubt that you will ever get this working. As Sastry mentioned, CR 10 did not support MS Server 2008 R2. The only version of CR (using classic ASP) to support anything close (WIN 7) was CR XI R2 (v. 11.5.x), Service Pack 6. See the following wiki for more details:
Crystal Reports v. 9.1 to SAP Crystal Reports, developer version for Microsoft Visual Studio Runtime Distribution and S…
For CR XI R2 SP 6 and WIN 7 I wrote a small blog - essentially collating info reported by customers on how to get ASP working - on WIN 7 (sometimes this works, other times...). See:
Report Designer Component (RDC) in classic ASP applications on Win 2008 Server and Win 7 - Possible Solutions
Please note that both CR 10.x and 11.5.x are out of support (have been for years). My recommendation, understanding that porting the app to more recent versions of CR and either the .NET or Java SDK is not possible:
Update to CR XI R2 and keep your fingers crossed. Your chances of getting this to work CR 10 are pretty well zero. Your chance of getting this to work with CR XI R2 SP 6 are better, but still approaching zero. You may be able to obtain CR XI R2 by calling sales (866-681-3435) or check the Worldwide Office Locations | SAP.
Last note. If you do manage to get CR XI R2, please so keep in mind that:
1) CR XI R2 is no longer supported.
2) You will be using CR XI R2 in an unsupported environment (Server 2008).
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter -
How to get reports cumulated balances? need help please
Dear all,
I need your help please in this issue.
I am creting a report using reports designer in oracle, well the fact is i don't know how to do the following:
if i have for example in the report the following to be diplayed :
Date Amount Balance
25/5/2011 2000
27/5/2011 5000 should be calculated and equal to 2000+5000=*7000*
28/5/2011 4000 calculated and equal to 7000 + 4000=*11000*
29/5/2011 1000 calculated equal to 11000 + 1000 = 12000
what is the method so i can get the balance values calculated 7000, 11000 and 12000? what do i do? any hints please
thanks for your helpUsing analytic function can be done through query as below...
SQL> SELECT EMPNO, ENAME, SAL, SUM(SAL) OVER (ORDER BY SAL ROWS UNBOUNDED PRECEDING) RUNNING_BALANCE
2 FROM SCOTT.EMP
3 /
EMPNO ENAME SAL RUNNING_BALANCE
7369 SMITH 800 800
7900 JAMES 950 1750
7876 ADAMS 1100 2850
7521 WARD 1250 4100
7654 MARTIN 1250 5350
7934 MILLER 1300 6650
7844 TURNER 1500 8150
7499 ALLEN 1600 9750
7782 CLARK 2450 12200
7698 BLAKE 2850 15050
7566 JONES 2975 18025
7788 SCOTT 3000 21025
7902 FORD 3000 24025
7839 KING 5000 29025
14 rows selected.
SQL> -Ammad -
Data Template---master details query--Help
Hi
we are using XML Publisher attached to R12 , we are using data template ( .XML file) in data definition .
we have a requirement for master details report. for that we have parent query and child query .the data coming to parent query should be the parameter to child query
Exp-- Parent Query-- select empno from emp
Child Query --select * from dept where empno=:p_empno (p_empno =empno from Parent query )
For this requirement we are creating a data template (.XML file) . we are successfully to write for the parent query, but we fails when come to child query. Please help us how it can be wrote in data template . You can send any example related to this issue.Parent Query - select empno as emp_no from emp
Child Query - select * from empno where empno=:emp_no -
I am unable to download pictures from my Sony Cybershot to my iMac, I have tried using the USB port as well as simply inserting the memory stick into the slot. I have been able to do this in the past as recently as a few weeks ago.... Help please..
Thanks Eric for responding.
I checked and it does not appear in the Applications folder.
I tried yesterday on an ethernet connection with a download speed of 2 Mbps but, unfortunately the connection died(It happened from the ISP end, which is out of my control) in between after which there was no trace of the download that happened for so long(till the internet connection death).
One more serious query which I am unable to understand. If the internet connection, dies in the midst of the download is in progress why is it so that the state does not persist and one has to restart the entire process again. Is there no solution for this?
I tried so many times and its the same case after some amount of download it vanishes. So many unsuccessful attempts. I am ****** off now. Is it not possible to see Mavericks? Why does different machines of Apple behave differently? Somewhere it goes smoothly and somewhere like my mine. Why did not Apple release a non apple store version? Is this not a bad sign of letting the users struggle when something is being offered for free?
The reason I asked as whether we can download the .app of Mavericks is that, there are so many applications that I have downloaded web and have installed. All that works fine. Can't we do the same here? You download a copy of Mavericks installer application and upload it for me in Google drive or like online storage places which can be downloaded and used by me? Help me understand.
Thanks again. -
Dreamweaver recordset query help!
HI im building a search page on dreamweaver based on bars clubs and pubs. At the moment i have 3 checkboxes labelled Bar, Club and pub with list/menu. I want the checkboxes so that when 1 is clicked eg Club it will come up with all the clubs in the database. However at the moment when i click that it comes up with the right amount of records but with clubs, bars and pubs.
Also i want it so that if i select Clubs and Pubs in the checkboxes, or all 3 checkboxes selected, it will come up with all the Clubs and Pubs in the database and so forth.
This is the SQL query in the recordset i created to get the values from the search page. I think this is wherte its going wrong
SELECT *
FROM `places`
WHERE `Town` LIKE %area% AND `MusicGenre` LIKE %music% AND (`DisabledAcess` = 'Yes' OR da1 ='0' ) AND (`Club/Bar/Pub` = 'Club' OR club1 = '0') AND (`Club/Bar/Pub` = 'Pub' OR pub1 = '0') AND (`Club/Bar/Pub` = 'Bar' OR bar1 = '0')
ORDER BY `Name` ASC
Help Please!Checkbox's won't exist on the submitted page unless they are ticked.
so i might do something like: ( untested )
SELECT
FROM `places`
WHERE
`Town` LIKE %area%
AND `MusicGenre` LIKE %music%
AND (`DisabledAcess` = 'Yes' OR da1 ='0' )
<cfif isdefined("form.club)" OR isdefined("form.pub)" OR isdefined("form.bar)">
AND
<cfif isdefined("form.club)">
`Club/Bar/Pub` = 'Club' OR
</CFIF>
<cfif isdefined("form.PUB)">
`Club/Bar/Pub` = 'pub' OR
</CFIF>
<cfif isdefined("form.BAR)">
`Club/Bar/Pub` = 'bar' OR
</CFIF>
1 = 2
</cfif>
ORDER BY
`Name` ASC
PS. Its a bad idea to name a database field something like `Club/Bar/Pub` ( but i assume that just an example, and not real) -
quote:
<cfoutput query="stand">
<tr bgcolor="#IIf(CurrentRow Mod 2, DE('ffffff'),
DE('cccccc'))#">
<td>
<select name="score_identifierscore"
id="score_identifierscore">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<input name="score_identifier" type="hidden"
id="score_identifier" value="#stand.ident_name#">
<input name="score_teacherid" type="hidden"
id="score_teacherid" value="#session.pstid#">
<input name="score_studentid" type="hidden"
id="score_studentid" value="#url.stid#">
<input name="score_vid" type="hidden" id="score_vid"
value="#url.vid#">
<input name="score_staid" type="hidden" id="score_staid"
value="#url.staid#">
<input name="score_studentname" type="hidden"
value="#studentname.first_name# #studentname.last_name#">
</td>
<td><div
align="center">#stand.ident_name#</div></td>
<td> #stand.ident_description#</td>
</tr>
</cfoutput>
Start off by saying I work for a school corp, so my knowledge
is limited to what I've taught myself and any help will be
appreciated.
Alright, here's what I have. I'm dynamically creating a list
of standards and for each standard I want to submit a score chosen
by the teacher and the identifier along with some other
information. My problem is that on the insert I can't figure out
how to match score with identifier. I can't possibly create a field
in the table for every identifier, so I need to take the list and
insert it into another table with score_identifer and
score_identifierscore and so on....the above way is not workign for
me.
How can I get this accomplished, I can usually work off of
examples, so please examples or any help please? If you have a
better way, I'm up for it, because this way isn't working.
Thanks in advance...quote:
Originally posted by:
AlwaysWannaLearn
What does the INSERT statement look like?
Why can't you create a table with columns names as: PK,
score_identifierscore, score_identifier, score_teacherid,
score_studentid, score_vid, score_staid, score_studentname this way
you can also map any of these fields against other tables to create
a more robust query result set?
Almost exactly the way I have it setup. Small snippet of the
dynamically generate html code that the user inputs. The problem is
in my insert statement:
<tr bgcolor="ffffff">
<td>
<select name="score_identifierscore"
id="score_identifierscore">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<input name="score_identifier" type="hidden"
id="score_identifier" value="F1.17.1 ">
</td>
<td><div align="center">F1.17.1
</div></td>
<td> Estimate and secure necessary supplies
</td>
</tr>
<tr bgcolor="cccccc">
<td>
<select name="score_identifierscore"
id="score_identifierscore">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<input name="score_identifier" type="hidden"
id="score_identifier" value="F1.17.2">
</td>
<td><div align="center">F1.17.2
</div></td>
<td> Determine plants, shrubs, and tree
locations
</td>
</tr>
<input name="score_teacherid" type="hidden"
id="score_teacherid" value="#session.pstid#">
<input name="score_studentid" type="hidden"
id="score_studentid" value="#url.stid#">
<input name="score_vid" type="hidden" id="score_vid"
value="#url.vid#">
<input name="score_staid" type="hidden" id="score_staid"
value="#url.staid#">
<input name="score_studentname" type="hidden"
value="#studentname.first_name# #studentname.last_name#">
Here's my insert statement, but now that I've look at it,
that won't match the identifier with the score, so it's crap. Any
help is appreciated. Thanks
<cfloop index="I" list="#form.score_identifier#"
delimiters=",">
<cfquery datasource="whatever">
INSERT INTO voc_scores
(score_studentid, score_vid, score_staid, score_identifier,
score_teacherid, score_studentname,score_identifierscore)
VALUES('#FORM.score_studentid#','#FORM.score_vid#','#FORM.score_staid#','#I#','#FORM.score _teacherid#','#FORM.score_studentname#',
'#FORM.score_identifierscore#')
</cfquery>
</cfloop> -
Hey guys and gals,
I'm new here and would like some assistance. I work for a company as an entry level support tech. I create emails and update distribution lists ect.. I'm by no means an exchange guru. We have a client that likes to have his employees
emails forwarded to him. But now he wants to know who is forwarded to him now. I have no clue how to find this out. So i did some research and i came up with the shell script
Get-Mailbox | Where {$_.ForwardingAddress -like John} | Select Name, ForwardingAddress, DeliverToMailboxAndForward
Of course it doesn't come back with anyhting. I'm assuming i've got the syntax wrong.
Can any of you lend some help please. I've been researching for the past week and can't seem to figure out why that isn't working. (i've tried ", (), %, '. I'm assuming it's the -like portion of the query.Hello,
You need to give * around the name to get the result...
So try this...
Get-Mailbox -ResultSize Unlimited | Where {$_.ForwardingAddress -like "*John*"} | Select Name, ForwardingAddress, DeliverToMailboxAndForward -
b font color ='red' Java JDBC and Oracle DB URGENT HELP PLEASE /font /b
Hello, I am a newbie. I'm very interested in Java in relation to JDBC, Oracle and SAP.I am trying to connect to an Oracle DB and I have problems to display the output on the consule in my application. What am I doing wrong here . Please help me. This is my code: Please Explain
import java.sql.*;
import java.sql.DriverManager;
import java.sql.Connection;
public class SqlConnection {
public static void main(String[] args) {
Class.forName("oracle.jdbc.driver.OracleDriver"); //Loading the Oracle Driver.
Connection con = DriverManager.getConnection
("jdbc:orcle:thin:@34.218.5.3:1521:ruka","data","data"); //making the connection.
Statement stmt = con.createStatement ();// Sending a query to the database
ResultSet rs = stmt.executeQuery("SELECT man,jean,test,kok FROM sa_kostl");
while (rs.next()) {
String man = rs.getString("1");
String jean = rs.getString("2");
String test = rs.getString("3");
String kok = rs.getString("4");
System.out.println( man, jean, test,kok );//here where my the
//compiler gives me errors
stmt.close();
con.close();
}<b><font color ='red'>Java JDBC and Oracle DB URGENT HELP PLEASE</font></b>Too bad your attempt at getting your subject to have greater attention failed :p
-
I need help please with the following query.
I have a table that contains a currency, voucher, start_date and a value.
Data in the tables looks like this:
GB, 31/05/2010, A, 100
GB, 31/05/2010, B, 250
GB, 31/05/2010, A, 72
GB, 12/12/2009, A, 1000
GB, 12/12/2009, B, 72
LX, 12/05/2010, A, 90
This is where it gets complicated, I need to show the total(SUM) value when the start_date < 60 days from sysdate and also when the start_date > 61 days AND only if the voucher = A and partioned by the currency.
So, in other words I need my results like this.
GB, 31/05/2010, A, 100, *172, 0*
GB, 31/05/2010, B, 250, *0, 0*
GB, 31/05/2010, A, 72, *172, 0*
GB, 12/12/2009, A, 1000, *0, 1000*
GB, 12/12/2009, B, 72, *0, 0*
LX, 12/05/2010, A, 90, *90, 0*
The bold columns are what I need, one called less_than and one more_than.
A big big thank you and any advice I appreciate.
SPlease make a habit of posting sample data we can work with right away by using CREATE TABLE and INSERT INTO statements, or use the WITH clause as shown below:
SQL> with t as ( -- generating sample data:
2 select 'GB' currency, to_date('31/05/2010', 'dd/mm/yyyy') start_date, 'A' voucher, 100 value from dual union
3 select 'GB', to_date('31/05/2010', 'dd/mm/yyyy'), 'B', 250 from dual union
4 select 'GB', to_date('31/05/2010', 'dd/mm/yyyy'), 'A', 72 from dual union
5 select 'GB', to_date('12/12/2009', 'dd/mm/yyyy'), 'A', 1000 from dual union
6 select 'GB', to_date('12/12/2009', 'dd/mm/yyyy'), 'B', 72 from dual union
7 select 'LX', to_date('12/05/2010', 'dd/mm/yyyy'), 'A', 90 from dual
8 )
9 --
10 -- actual query:
11 --
12 select currency
13 , start_date
14 , voucher
15 , value
16 , sum(case
17 when trunc(sysdate-start_date)< 60
18 and voucher = 'A'
19 then value
20 else 0
21 end) over (partition by currency, voucher, start_date) sum_val1
22 , sum(case
23 when trunc(sysdate-start_date)> 61
24 and voucher = 'A'
25 then value
26 else 0
27 end) over (partition by currency, voucher, start_date) sum_val2
28 from t;
CU START_DAT V VALUE SUM_VAL1 SUM_VAL2
GB 12-DEC-09 A 1000 0 1000
GB 31-MAY-10 A 72 172 0
GB 31-MAY-10 A 100 172 0
GB 12-DEC-09 B 72 0 0
GB 31-MAY-10 B 250 0 0
LX 12-MAY-10 A 90 90 0
6 rows selected. -
I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!
There are no updates to either OS 10.5.8 or Safari 5.0.6.
If you need a later version of Safari you must first upgrade your operating system to a later version of OS X. -
Please see my ? above: Im making an IMovie and need the last frame to just be text (can be on a color). I don't know how to go about doing this. Ive already done all my photos and captions. Need to have it ready for TOMORROW: Friday May 23rd. Help please!
ThanksYou can choose a background for the text from Maps and Backgrounds. Just drag a background to the end of the timeline, adjust to desired duration then drag title above it.
Geoff. -
I have a Bose soundtouch system .Until today I could play my iTunes music through it via air player . .I have just uploaded the latest upgrade from iTunes and now I am unable to connect to the Bose system . Can anyone help please? I can connect via my iPad and by using the Bose app so it is not the Bose at fault
@puebloryan, I realize this thread is a bit old, but I have encountered a similr problem and wondered if you had found a solution. I've been using home sharing from itines on my PCs for years, but two days ago, it suddenly stopped. I can share from my Macs, but not from the ONE PC library where I keep all my tunes. I tried all the usual trouble-shooting measures.
After turning home sharing off on the PC's iTunes, turning it back on and turning some other settings off and on, my Macs and Apple TV could briefly "see" the PC library, but as soon as I try to connect -- the wheel spins for a bit and then the connection vanishes. It's as if they try and then give up.
Since this sounds so similar to your problem, I was hoping you finally found a solution. I am also starting a new thread. Thanks!
Maybe you are looking for
-
Accessing portal dictionary tables from Web Dynpro project
Hi Am a new to whole portal and webdynpro thing, and I hope that you can help here I created a new dictionary project through NWDS and created a table with columns and I successfully deployed it I also created a web dynpro project and I added a TABEL
-
How to switch off the loudspeaker during the video...
Hi everybody! That is an old problem, and I found lots of topics and messages, but still no solution. How long could it take, and how many programmers and designers should work till we can get the button for switching on and off the loudspeaker?
-
In and Sent mail missing how to recover?
Running latest version of Snow Leopard. Switched over to iCloud before the drop dead date. All has been fine until this morning when my In and Sent boxes were empty of all messages. Archived and mail moved to other folders remain. Rebuild remains gre
-
How do you switch off WiFi - is there an easy way?
Hi I am coming from SPV MS Smartphones. My mate has got a new one with WiFi in, and it has a lovely shortcut menu to switch in ll WiFi, BT etc. How do you switch off the WiFi on the N80, I read in the manual that "WiFi is always on" surely this canno
-
I'm using amxmlc to build a SWF from an MXML source code file. I'm passing -swf-version=13 to amxmlc. In the MXML source, I have the following line: <s:TextArea id="inputTextArea" width="100%" height="100" fontSize="28" borderColor="#000000" skinClas