SQL Questions


SQL query to select highest test score
I am writing a sql to bring someone’s highest test score into a table. The sql is bringing in the highest test score possible, rather than the person’s test score. I assume MAX is making that happen. If I take MAX out, it returns the single row subquery returns more than one row error. What [...]

Answer Question   |  November 21, 2008  11:42 PM
Distinct Records, MAX, SQL, SQL Query, SQL tables
asked by:
40 pts.

Update help needed
I need to perform an update as follows… Update LIBNAME.SDFILE Inner Join LIBNAME.DXFILE On SDPRDC = DXPRDC And SDSENO = DXSENO And SDORNO = DXORNO And SDLINE = DXLINE Set DXDNAM = ”, DXDAD1 = ”, DXDAD2 = ”, DXDAD3 = ”, DXDAD4 = ”, DXDPCD = ”, DXINVN = 0 Where SDIECD = ‘SO’ [...]

Answer Question   |  November 19, 2008  6:28 PM
DB2, i5, SQL, UDB for iSeries/i5
asked by:
415 pts.

sql table in rpg
I need to read an sql table (file) in rpg and select certain records. I’m pretty green in sql. Anyone have a sample they could share? I’am better at rpg than ile., but I’ll take what I can get. Thanks

Answer Question   |  November 17, 2008  6:21 PM
RPG, SQL, SQL tables
asked by:
170 pts.

Migrate FROM SQL2005 Ent. TO SQL2005 Standard
We recently installed and have been running SQL 2005 Ent. because that is what we planned to use. During the 180 day window our needs have changed and we purchased Standard edition rather than Enterprise. Now we need to migrate from Enterprise to Standard. My question is what is the best way to do this. [...]

Answer Question   |  November 14, 2008  3:28 PM
SQL, SQL 2005, SQL Server, SQL Server 2005, SQL Server 2005 Enterprise Edition, SQL Server migration
asked by:
5 pts.

iSeries RPG Embedded SQL Performance
Hi, I’m trying to replace some long running Query/400 jobs with RPG and embedded SQL. Some of the existing jobs run for almost 24 hours on our machine. I’ve already successfully managed to reduce a few of these jobs to a matter of minutes using embedded SQL. So far, so good. My problem is when [...]

Answer Question   |  November 14, 2008  2:17 PM
AS/400 performance, Embedded SQL, iSeries, Query/400, Query/400 Performance, RPG, SQL
asked by:
23,625 pts.

SQL Server trigger , insert result of multiple where clause into a variable
Hi All, I have a select statement that stores the result in a variable,this works fine if there is only one condition and field in the clause.How do I go about it if there is more than one? For example (Working one) SELECT @Variable = (SELECT [Field] FROM [Table] WHERE [FIELD] = Value) But I [...]

Answer Question   |  November 12, 2008  8:23 AM
SELECT statement, SQL, SQL variables, Triggers
asked by:
20 pts.

SQL 2005 trial version update
I installed SQL 2005 trial version on a production server and the 6 months are almost up. I would like to go to SQL 2008 since I can get a very good deal for it. What options do I have? Can I just upgrade over the trial version or I need to uninstall 2005 and [...]

Answer Question   |  November 10, 2008  7:13 PM
SQL, SQL 2005, SQL 2008, SQL Server Enterprise Edition, SQL Server upgrades
asked by:
30 pts.

MySQL vs SQL server
If I was going to get some web pages designed to interact with a database on my server would I be better using MySQL or SQL small business server? Is there a huge difference in what they’re cabable of or does it just change what front-end you use? Why would I need a WAMP stack [...]

Answer Question   |  February 27, 2011  4:34 PM
MySQL, SQL, SQL Small Business Server, WAMP Stack
asked by:
20 pts.

Webpage and SQL interaction
The problem I need to figure out is that I need to have client information stored on an SQL server database and I need something to be able to use this information to get quotes from several insurance companies. All these companies require different info in a different order. So my questions are as follows: [...]

Answer Question   |  November 6, 2008  1:53 PM
Programming Languages, SQL, SQL Server database, Web development
asked by:
20 pts.

SQL proceedure to join header and detail file
I want to know how to set up a SQL procedure that joins a header file and detail file where the status field in header = ‘X’ then updates this header record after selecting the detail records.

Answer Question   |  November 4, 2008  5:48 PM
AS/400, DB2, SQL, SQL procedure
485 pts.

Prevent Update in DB2 SQL External Trigger Program
I have a 3rd party application that maintains a customer master file (update, insert, delete) and I cannot alter their programs. I would like to put a trigger on the database file to fire an external program on insert and determine if the insert should be performed. If not, I would like to send a [...]

Answer Question   |  November 6, 2008  4:29 PM
AS/400, DB2, SQL, Triggers
asked by:
25 pts.

Haversine formula in RPG or SQL
I need to put the haversine formula in an sql or rpg function on the as400 to calc the distance between to zip codes. I do not have much experience with sql. can anyone give me some help?

Answer Question   |  November 6, 2008  10:01 PM
AS/400 development, Great-circle distance, Haversine formula, RPG, SQL
asked by:
170 pts.

Ignoring fields in SQL Where Statement
Can fields in a where statment be ingnored. Such as Where name = :name and date = :date, but if I just pass in a name I’d like the where to select only on the name and ignore the date.

Answer Question   |  November 3, 2008  8:13 PM
SQL, SQL WHERE statement, SQL/400, WHERE statement
asked by:
5 pts.

Issue SQL Query with Localized String through PowerShell
Hello, I am attempting to execute a an SQL query through PowerShell against an MS Access database. My query works 99% of the time, but occasionally a localized string will cause an error beacuse it contains a single quote (‘) somewhere within the localized string. You can look at the following example to get a [...]

Answer Question   |  November 5, 2008  11:51 AM
Database programming, Localized String, Microsoft Access, PowerShell, Scripting, SQL, SQL Query, Windows PowerShell, Windows scripting
asked by:
15 pts.

SQL help
hiow to pick only alphbets in a string or a column using sql

Answer Question   |  November 3, 2008  9:43 AM
Data Types, SQL, SQL Query
asked by:
35 pts.

How do I use the results of count(*)=0
I am using SQL to code a select statement. If the result of the statement = count(*)=0, I want to put a message out on a report.

Answer Question   |  November 10, 2008  11:18 AM
count(*)=0, SELECT statement, SQL
asked by:
85 pts.

Insert superscript text into Oracle database
how can i insert superscript or subscript text to the data base i have colomn called measuments Units and i want to insert quadratic meter M2 or Cubing meter M3 am using oracle 9i pleeez help

Answer Question   |  November 6, 2008  10:23 AM
Data Types, Oracle 9i, Oracle developers, SQL
asked by:
115 pts.

SQL Queries
pls any one help me I Need to disply in o/p only alphabets but not any numbers or integers for this i/p as follows i/p o/p —– ———- 1.2NE NE 1.1NN NN 1.3.1NE NE 1.1CE CE 1.2.2NN NN 1.6.2NN NN 1.3CE CE 1.3CE CE 1.1 — 2 —- 11 – THANKS IN ADVANCE SURENDRA

Answer Question   |  November 25, 2008  3:42 AM
Data Types, SQL, SQL Query
asked by:
35 pts.

I need to display only last two characters
i need to disply only last two characters in a column, the column data like this 1.3.2NE,1.2.2NN,1.10CE,1.11.1NN,10.3 for this i need output like this NE,NN,CE,NN

Answer Question   |  October 24, 2008  3:14 AM
SQL, SQL Query
asked by:
35 pts.

Return specific level parent
Can anyone help? I have a table, with 7 records ID ParentID Level ——- ————- ————— 01 (empty) 1 A 01 2 BC A 3 X BC 4 B 01 2 DE B 3 Y DE 4 I need a query to return, for every record in the table, the corresponding ‘Level 2′ ID, excluding [...]

Answer Question   |  October 22, 2008  11:04 AM
Database programming, SQL, SQL Query
asked by:
5 pts.