Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. tnguyen315

    Please help with Access query with groupby on Union All query.

    I tried to create a query below. It's weird that when i copied the table with left few records in there, it's worked and showed corrected results. However, when i switched back to the original table with thousands, thousands records in there, and it's not working. It's showing single record in...
  2. tnguyen315

    Please help with Access query with groupby on Union All query.

    Thanks again LaurieHamlin. I tried to grouped by all fields but didn't work. I'm trying to see if i can use UNION query as a sub query but couldn't find a solution yet. TN
  3. tnguyen315

    Please help with Access query with groupby on Union All query.

    Thanks LaurieHamlin for your time. If i try to group by, it's only worked on the first 2 parts For each tableA.STREET, If LOW_Right > 0 and there are multiple rows of tableA.STREET and LOW_Right that have the same value, only the row that has the highest UP_Right value should be shown For each...
  4. tnguyen315

    Please help with Access query with groupby on Union All query.

    Hello, I created an access query with union. Everything is working fine now. But i would like to eliminate the duplicate records if more than one have the same Full street address. Here is my query: SELECT tableA.LOW_Right as From, tableA.UP_Right AS To, 1 AS Status, tableA.STREET AS...
  5. tnguyen315

    When was my SQL Server Databases last accessed/used?

    Please help. I have SQL server 2000 and trying to migrate to either 2008 R2 or 2012. However, I have tons of databases in SQL Server 2000. Is there any sample script that i can use to find out the last accessed date of the SQL Server databases? I need to know if the databases are in use or if...
  6. tnguyen315

    please help with subqueries

    gmmastros, thank you so much for your help. I'm so appreciated. I'm about to say that the first code is showing all patients with P status when testing. I tested your second script and everything worked so fine. It showed all M patients with no P patients in the next 30 days booked. Again...
  7. tnguyen315

    please help with subqueries

    Thanks all the the quick respond. gmmastros, yes that's exactly what i'm looking for. however i need to join with other tables as well. Again, thank you so much
  8. tnguyen315

    please help with subqueries

    I'm using SQL 2008 R2, i have a query SELECT Mpfile.PATIENT_NO AS [Patient No.], Padfile.CLINIC AS Clinic, Tbclinic.DESCRIPTION AS ClinicDesc, Padfile.APPT_DATE, Padfile.TYPE AS Type, Padfile.DISPOSITION AS Status FROM dbo.MPFILE AS Mpfile INNER JOIN...
  9. tnguyen315

    How to check on date time stamp when record has been inserted into table

    Thanks everyonẹ That's what i thought. No luck, there's no date stored. I'll try to search and see if any of those related tables so I can get the date from there. Again, thank you so much.
  10. tnguyen315

    How to check on date time stamp when record has been inserted into table

    I'm using SQL server 2008 R2. I have an "Employee" table with no date time stamp column. I would like to track down the initial date time stamp when each employee has been inserted into table. I know that if i add a new column with Getdate() function, this date is just apply for new record only...
  11. tnguyen315

    Error on update SQL view, please help

    I'm using SQL 2008 R2. I'm trying to update the MAX record from another table to the view but got error. Error "Msg 4406, Level 16, State 1, Line 1 Update or insert of view or function 'dbo.V_Notes_1' failed because it contains a derived or constant field." My code: UPDATE dbo.V_Notes_1 SET...
  12. tnguyen315

    SQL query to return a column of previous date

    Thank you so much DaveInIowa and gmmastros I tried LAG funciton but mine is still 2008 R2 server, and got error because it's not recognized the function. I used gmmastros code on a simple query, it worked but took so long to get the result. With Data As ( Select PATIENT_NO, IMM_DATE...
  13. tnguyen315

    SQL query to return a column of previous date

    Let me explain this, the query result: ID VisitDate 125 1/1/2012 125 8/25/2012 125 1/8/2013 257 6/7/2012 257 9/15/2012 257 3/15/2013 257 6/1/2013 Now i would like to create another new column call "Previous Date" and pull data from VisitDate such as: ID...
  14. tnguyen315

    how to execute stored procedure from access vba using DAO with trusted connection, ODBC, DSN = 'DTe'

    I got it worked, all i needed is OperatorID only i changed these on function and code: Public Function ResendPaymentEmailAddress(strOperatorID As Integer) As String ,.... .... rst.Source = "EXEC sp_ResendPayEmail " & strOperatorID from my code changed to this: strResendEmail =...
  15. tnguyen315

    how to execute stored procedure from access vba using DAO with trusted connection, ODBC, DSN = 'DTe'

    thanks dhookom for your advice. However, sorry for the confusion. my module name "modSendEmail" and function named "ResendPaymentEmailAddress" Public Function ResendPaymentEmailAddress(strOperatorID As Integer, strOperatorName As String, strOperatorEmail As String) As String i tested with no...
  16. tnguyen315

    how to execute stored procedure from access vba using DAO with trusted connection, ODBC, DSN = 'DTe'

    OK here's what i did, i added the Microsoft ActiveXData Objects 2.5 as you said i create a module named "ResendPaymentEmailAddress" Option Compare Database Option Explicit Public rst As ADODB.Recordset Public con As ADODB.Connection Public strCon As String Public strOperatorID As Integer...
  17. tnguyen315

    how to execute stored procedure from access vba using DAO with trusted connection, ODBC, DSN = 'DTe'

    i tried to use this but got error when i clicked on the button error : complile error: User-definied type not defined Private Sub cmdSendEmail_Click() On Error GoTo Err_cmdSendEmail_Click Dim conn As New ADODB.Connection Dim cmd As New ADODB.Command Dim strConn As String...
  18. tnguyen315

    how to execute stored procedure from access vba using DAO with trusted connection, ODBC, DSN = 'DTe'

    This is the stored procedure: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[sp_ResendPayEmail] ( @id int ) AS DECLARE @operatorname AS nvarchar(100), @operatoremail AS nvarchar(100), @title AS nvarchar(100), @message AS nvarchar(max), @webpermitid AS int --CHECK...
  19. tnguyen315

    Error in updating SQL statement, The multi-part identifier could not be bound.

    Hello, I tried to run the update state but i got errors and couldn't figure out what's wrong, please help. Thanks in advance. TN Here's my code: --Update Title X - addnote field update ENHFILE set e.X12_ADD_NOTE = ( select distinct case when RACE = 'A' then '5' when RACE = 'B' then...
  20. tnguyen315

    Error in update SQL statement, The multi-part identifier could not be bound.

    Hello, I tried to run the update state but i got errors and couldn't figure out what's wrong, please help. Thanks in advance. TN Here's my code: --Update Title X - addnote field update ENHFILE set e.X12_ADD_NOTE = ( select distinct case when RACE = 'A' then '5' when RACE = 'B' then '2' when...

Part and Inventory Search

Back
Top