473,386 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help with SUB SELECT

Hello Please help me with this question..

I have a Table PGW.CNTL.

It contains Empl_ID and PGW_CNTL_ID which is updated when ever a record is updated. I need the EMPL_ID of the most current record and match it with EMPL Table to get the names

This is what i have Made...


Select E.Last_NAME, E.FIRST_NAME
FROM PGW_CNTL AS PGC
INNER JOIN (SELECT EMPL_ID AS AE, MAX(PGW_CNTL_ID) AS PT
FROM DB2DBA.PGW_CNTL AS PGC2 WHERE PGC2.EMPL_ID=???
) AS PGC3
ON ( PGC1.PT=PGC3.PGW_CNTL_ID)

INNER JOIN DB2DBA.EMPL AS E ON (E.EMPL_ID=PGC.EMPL_ID)


My Issue is.. I want a WHERE Clause in Sub Select to limit the EMPL_ID of PGC2 to current records i will be matching.. like PGC2 has all the records like 1 million.. I don't want to max the value of all the EMPL_ID in PGC2.. but limit it to the current...

Any Help will be appreciated
Feb 15 '11 #1
0 1247

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

Similar topics

1
by: Hunter | last post by:
Hi group - I'm using php to extract data from postgres and print to browser. I have data that was input through checkboxes on a form - each checkbox had a different value but got pushed into the...
1
by: Cooper | last post by:
Hello, I have definited two select: main, secondary main = 0, 1, 2 secondaryA = "a", "b", "c" secondaryB = "1", "2", "3" secondaryC = "5", "6", "15", "25" i want that, if i check from...
4
by: Neeper | last post by:
Hi, I've got a transactions table with a tstamp field (datetime type) and I need help creating a SELECT query to retrieve only last transactions that occured within the last 5 minutes. The...
1
by: Pieter Linden | last post by:
Hi, I think the subject line pretty much says it all... Say I have a students-classes database and I add a twist. I want to filter what courses a student can take by comparing the courses he...
2
by: Chris | last post by:
Hello all, I'm having some trouble setting up a query. Background: The table TBLSCREEN stores data about screenings of patients/subjects for eligibility to participate in a health study. A...
0
by: Josha | last post by:
How can a select command be limited to only select text existing as allcaps? It is a word document.
1
by: bpforte | last post by:
Hello, I need help with building query, basically I need to select all records from one table that don't exists in second table with status 1, but they can exists in second table with status 0, to...
5
by: Reshmi Jacob | last post by:
Hello Can I have more than one variable assign to a select clause in a trigger. How? My stmt creates an error SELECT FLD1 into VAR1, FLD2 into VAR2 FROM MYTABLE; ERROR shown at the second...
4
by: Matt Pegg | last post by:
Hi all, This I thought would be a relatively easy question, but after hunting around the net, I haven't been able to source an answer.. I have a large table in Access with four fields. I...
0
by: New2ASP | last post by:
Thanks everyone in advance for your help. I am fairly new to web development but an experienced window-based developer. Here's the structure of my Gridview Column 1 : Checkbox with SelectAll...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.