473,699 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using a count to filter excess data

15 New Member
SELECT Sheet1$.[Trial ID] AS [Trail ID], CASE Sheet1$.[Trial ID] WHEN 'CSPP100A2344' THEN '0' END AS Extension, SUBSTRING(Sheet 1$.[Patient ID], 1, 4)
AS [Center Number], SUBSTRING(Sheet 1$.[Patient ID], 5, 8) AS [Patient Number], SUBSTRING(Sheet 1$.[Patient ID], 1, 4)
+ '_' + SUBSTRING(Sheet 1$.[Patient ID], 5, 8) AS [Patient Identifier], Sheet1$.[Trial ID] + '_' + SUBSTRING(Sheet 1$.[Patient ID], 1, 4)
+ '_' + SUBSTRING(Sheet 1$.[Patient ID], 5, 8) AS [Study Number], Sheet1$.[First Name] + Sheet1$.Surname AS [Patient Initials],
CASE Sheet1$.NOTES WHEN 'visit 3' THEN '777' WHEN 'visit 11' THEN '778' WHEN 'unscheduled visit' THEN '999' END AS [Visit Report Number],
CASE Sheet1$.NOTES WHEN 'unscheduled visit' THEN '777' END AS [Repeat Visit Number],
CASE Sheet1$.NOTES WHEN 'unscheduled visit' THEN '777' END AS [Repeat Page Number], Row_NUMBER() OVER (Partition BY
Sheet1$.[Patient ID]
ORDER BY Sheet1$.[Patient ID]) AS [Record Number],
CASE Sheet1$.NOTES WHEN 'visit 3' THEN 'Day 1' WHEN 'visit 11' THEN 'Day 253' WHEN 'unschedule visit' THEN 'UNSCHEDULED VISIT' END AS [Visit Report Name],
CASE Sheet1$.Sex WHEN 'Female' THEN '2' WHEN 'Male' THEN '1' END AS Gender, UPPER(REPLACE(C ONVERT(char(11) , Sheet1$.[Date Of Birth], 106), ' ', ''))
AS [Date of Birth], M_PWA.SP, M_PWA.DP, UPPER(REPLACE(C ONVERT(char(11) , Sheet1$.DATETIM E, 106), ' ', '')) AS Date, CONVERT(char(5) , Sheet1$.DATETIM E,
108) AS Time, M_PWA.SUB_TYPE, CASE Sheet1$.Inconcl usive WHEN 'Yes' THEN '1' WHEN 'No' THEN '2' END AS Inconclusive, M_PWA.ED,
Sheet1$.[Operator Index], M_PWA.C_AP, Sheet1$.C_AP_HR 75, M_PWA.C_MPS, Sheet1$.HR, M_PWA.C_PH, M_PWA.C_AGPH, Sheet1$.C_AGPH_ HR75,
Sheet1$.C_SP, Sheet1$.C_DP, Sheet1$.C_MEANP , Sheet1$.C_T1, Sheet1$.C_T2, Sheet1$.C_AI, Sheet1$.C_ESP
FROM Sheet1$ INNER JOIN
M_PWA ON Sheet1$.DATETIM E = M_PWA.DATETIME
WHERE (CASE Sheet1$.Inconcl usive WHEN 'Yes' THEN '1' WHEN 'No' THEN '2' END = 2) AND (M_PWA.P_QC_PH >= 80) AND (M_PWA.P_QC_PHV <= 6) AND
(M_PWA.P_QC_DV <= 6) AND (Sheet1$.[Operator Index] >= 80)
GROUP BY Sheet1$_1.[Patient ID], Sheet1$_1.DATET IME
HAVING (COUNT(*) <= 2)

ORDER BY [Patient Identifier], Date, Time

ERROR MESSAGE

Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "Sheet1$_1.Pati ent ID" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "Sheet1$_1.DATE TIME" could not be bound.

What I am trying to accomplish is to get a count of parameters with an operator index >=80. Sometimes, I have more data than I can use for a given date. I need to filter the excess data away. All of the other items in the query work properly, it is just when I try to add the count feature (which I can get to work separately in a different query.
Jan 22 '07 #1
2 2106
iburyak
1,017 Recognized Expert Top Contributor
Can you successfully do?

[PHP]SELECT * FROM Sheet1$ [/PHP]
Jan 22 '07 #2
AtCor
15 New Member
Yes, no problem with that
Jan 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
24031
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked tables in the database where the code resides. If we move the database with the data tables to a new directory, the links are no longer valid. I tried to update the links by changing the Connect property and refreshing: Set td = db.TableDefs(0)...
1
1535
by: Simon Matthews | last post by:
Hope someone can help an Access beginner! I've just started keeping my surgical logbook on access and it's a simple flat-file affair. I have created several queries that will list cases performed at different hospitals and reports based on the queries to print out the relavent details. What I would like to do is have a summary sheet in the Report Footer section that lists a grid of each type of procedure performed as well as the...
11
6593
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on where the job is running, the job runs sucessfully, PDF files got generated, everything is good. If I scheduled the job to run at the time that I am not logged into the server, Access is not able to print to the printer. The error is pretty...
1
4009
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the live databases on the network. Is there a way, via code, when I get back in-house from being on the road to click a button, and select the backends I want to link to? I would want to delete all the current links and link to the "live"
1
5053
by: Prasad Karunakaran | last post by:
I am using the C# DirectoryEntry class to retrieve the Properties of an user object in the Active Directory. I need to get the First Name and Last Name as properties. I know it is not supported with the ADSI NT Provider and only supported in the LDAP Provider. So given an UserId (UID) how can I read the First Name and Last Name using LDAP Provider. If anybody can help me with a C# sample code it would of great help. Thanks in advance.
2
3303
by: Alpha | last post by:
I have a window application. In one of the form, a datagrid has a dataview as its datasource. Initial filtering result would give the datavew 3 items. When I double click on the datagrid to edit the selected lie item at which case I would pop up a separate dialog box to do so, in the debugging code, the dataview.count would return 0. I get a error message because I tried to get values out of a dataview that holds 0 items. Does anyone...
0
3388
by: anonieko | last post by:
This approach I found very efficient and FAST when compared to the rowcount, or Subquery Approaches. This is before the advent of a ranking function from DB such as ROW_NUMBER() in SQL Server 2005 and the likes of it. So This one works with SQL2000 What do you think?
4
2687
by: AtCor | last post by:
I am trying to filter data using count. For a given day and patient, I would like to return all the valid tests. When I use a count this way, it only returns the patients with at least 4 tests. I want it to display those patients that have 1, 2, 3, or 4 valid tests, but not if 5, 6 or .... we taken on a given day. I only need the first four valid tests. Any suggesions? SELECT Sheet1$. FROM M_PWA INNER JOIN ...
7
2258
by: bb nicole | last post by:
Is it have any php coding can count the character of messages, and after the message's character dint excess 160 character, it is first message, excess 160, it will show that the message is second message and so on, excess 350, it will become third message. is it use if else statement? But how to count the characters of message? Thanks.... :)
0
8618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9178
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8916
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8885
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6534
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2348
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.