I have a file of Part-no with the spend by Plant (or Location). A given Part-no may have multiple records for the different Plant Locations. I am trying to capture one record for each Part-no that included the Plant with the highest spend and what that amount is. I tried to do a summary query...
I issued a select statement like this: Select phone# from pltlcd where phone# >= 985143525 fetch first 20 records only PLTLCD is a file sorted by phone#. From the first record retrieved by the aboe select statement, how do I get the 20 records in the file that exist before the returned set of...
What is the difference between a key and an index? Whe I issue a SELECT statement, and the table has an index, do I still have to use my key?
As usual, I often use: select top 1 * from table But in DB2, I can't. I use Toad tool to input SQL statement. Who have any solution? Please share with me. Tks a lot!
I want to select a row from the parent table based on whether there are two or more rows in a child table. What is the best way to do that?
I'm struggling, along with others, where I'm getting different results when doing an Insert select verses just the select. Lots of joins to get data from various tables. Only want the first record from the uniqfield table so created the tmp_uniqfieldid table with that item fielded, creation_ts ...
Please help me write this. I need a SQL where the order by is done based on a variable passed to the query.SELECT * FROM (SELECT distinct gl.group_id, gl.group_name, gl.group_description, gl.status_code, gl.member_count, ...
I have over 400 records added to a table in a minute. A processed flag is set in each record as they are processed. I want to process each record exactly one time. I want to process the records in small groups with multiple processes; that may run on disparate machines. It is desirable to...
what are various select statements used and where are they used.what is value table.
How do I write a SQL statement to get all data from a table called subscrib?
I have a set of records in a SQL query result. I only want to see one record, per the data field "ID". I am getting 2 records for some ID's, as there is one field that is different in the 2 records. This happens even if I start the query out with SELECT, DISTINCT, and then all of the fields I...
Hello everyone, I work in a telco and manage the data in the company's CRM. I'm often given lists of company names by our alliance team, and asked to match the list against our database to see which companies already exist in the CRM and which don't. At the moment I can only accomplish this by...
In DB2 when I'm giving a select statement its taking lot of time, the reason is like the table is a very huge table. As a result some times it is locking the table. Can any one help me for executing the select query with any option which would not lock the table. Thank you in advance.
I want to pass the result of a sql query as the column name in another query eg. (note there will be a single result for the first query) SELECT CASE WHEN fld_type1 = 'A' THEN 'VAL_ALPHA1' WHEN fld_type1 = 'D' THEN 'VAL_DATE1' ELSE 'VAL_NUM1' END AS FIELDNAME FROM TABLE1 I want the result of the...
Is there a way to configure SQL Server to not lock tables where I am using the SELECT statement, so as to not have to writte "with NOLOCK" every time I use SELECT?
I am experiencing slow views on my database. If I create a view and run it, then use the same select statement from the view and run. They both return the same data, but View runs slower. My expectations was that since views are compiled, they should run faster. Could some one clearify this for me....
Hey guys!!! I'm quite new to VB.NET 2005. I need to know how to add, update and retrieve data manually using VB.NET 2005. In the software which I'm trying to implement, data is entered in text boxes and then they are updated/added into an SQL table. When retrieving the...
Hi, The below inner SELECT returns huge amount of rows (1000000+) and the outer SELECTs(alpha BETWEEN #startRec# AND #endRec#) is used for PAGINATION to display data with 25 in each page. Issue is:-This PAGINATION done below is very slow and slows the entire display of data.So could all please...
How do you write a SQL query to find a specific word in a sql column. ex I want to show all records that have the word bob in it but do not want to include records that are bobby or bobble etc only the exact word bob. Hope that makes sense
Sorry if the title is a bit vague but its almost what am I trying to solve. The best way to explain my issue is this. If I have a table which takes the format.. user_id, error_code. (and other values also). The problem is that the same user_id is listed multiple times for each error_code the...


