Advertisement

635 organizations, including eBay, Ericsson and Lockheed Martin, now work smarter with Corporate Accounts. Save up to 42%

 

Welcome! If you have any general questions about Experts Exchange, feel free to ask me.

 
Time Tested SQL Syntax Solutions: 276 - 300 of 2308
 
I have one table I need to pull a record from per id. Each ID can be shown mulitiple times with new pricing and update dates. I need to pull the record with the last update per ID. Thoughts? I...
I have a stored procedure using 5 tables and  experiencing a SQLSTATE =42000 incorrect syntax  found near the Keyword "ON" .  The error message points to a statement near the bottom of the pro...
I have an MS Access tabe in which all of the data types are text (this is necessary and cannot be changed).  My issue is that I believe, because of the fact that all table data is text, I need...
I would like to do this: SELECT DATEDIFF(dd, '10/27/2007, '10/28/2007') > 0 This would return 1 or True, but the syntax is not accepted by SQL Server. However, I'm looking for something c...
I'm trying to make my dynamic SQL sort work.  I'm sorting by 3 values but the second one's sort order (asc/desc) depends on an input parameter.  It all works except for when the second value's...
I am moving an asp app to .net and would like to know how to retrieve a value from a newly inserted row in a table.  The asp looked like this: strSQL =  "SET NOCOUNT ON;" &_                  "INSERT I...
I want to do: ((SUM(dbo.GLSUM.ACTIVITY * - 1) / SUM(dbo.BUDGETS.ACTIVITY * - 1)) / SUM(dbo.BUDGETS.ACTIVITY * - 1) ) But  the  query tool keeps changing my statement to: SUM(dbo.GLSUM.ACTIV...
Hi, I am going to change the order of a tables columns in database 'A' and re-apply the contraints so it is the same as database 'B'. i get the current order from 'A' with desc table_...
SQL SELECT *  Where dateAdded >= GETDATE() - 1   -  how to modify this to Just TODAY? I have the following query above which returns all records in the last 24 hours. I would like to learn ...
Is there an existing function in DB2 SQL, to convert date format from '10/24/2008' to '2008-10-24' AND is there an equivalent to DATEPART('yyyy', MyDate) in DB2 SQL Thanks
I have 5 spreadsheets.  4 represent one very large table placed on 4 sheets.  One is a small seperate table with 3K records and one field in common with the large table placed on 4 sheets. ...
Objective:  Update table dbo_LEASEBUT4 based on a value in table dbo_LEASEBUT7 The following Syntax:: update dbo_LEASEBUT4 set dbo_LeaseBut4.leasid = (select dbo_LeaseBut7.leasid from dbo_Le...
I have the following fields in an Access Database called "Logs": RecordID, Zip, DonorIDDate I have this query to count, group, and display Unique records (Between 2 dates): "SELECT Logs...
I am getting the following error in my  code when i get to myDataReader = myCmd.executereader(): The SELECT statement includes a reserved word or an argument name that is misspelled or missin...
Hi, I seem to be making a mistake in a subquery routine for MS Access. If I start with this: SELECT t.employee, t.project, t.subproject, t.phase, t.notes, Sum(t.duration) AS hours, emplo...
Ok I am having a bit of a problem here.  I have the following syntax that does not work: select ponumber, postatus, potype, user2ent, docdate, vendorid, vendname, buyerid  from pop10100 wh...
I used the report wizard to creat a report that works great but I would like to set my criteria to pull information for only one job from my purchase order table instead of getting a report fo...
I want to update the values in one table based on the city they are in which is located in another table.  When I try to join the tables in my update command I get the following error message:...
I have the following query that connects dattbl_Case with dattbl_Policy dattbl_Policy sometimes has more then one row. When this occurs I need my query to merge both of the POL_NUM column r...
Hi, having a table A which looks like DATE                CRIT1                  CRIT2            CRIT3            X              Y              Z 1/1/1990           1/20/1990          ...
To select random records, you can execute: SELECT TOP 10 * FROM Products WHERE ProductName = 'bike' ORDER BY NEWID() Now, what I want to do is incorporate the above syntax in an upda...
I have a table with 3 columns, FullName, FirstName and LastName FullName is the only column with data as it includes a full name such as John Smith with the normal space between the first a...
I have a problem using the replace function in MS Access 2003.  Basically, instead of hardcover the find and replacement variables, I want to make to find by a column in another table, and rep...
I am trying to display a list of contact names for a drop down, but the first row of the result set needs to be a custom row.  Is there a way you can maually "insert" a row into the result set...
Having an issue with creating a dynamic sql string with a case statement in the middle to add parameters to the select if a variable is defined... Declare @SQL varchar(500) Select @SQL =...