[thelist] ASP: More Selective Select

Chris W. Parker cparker at swatgear.com
Wed Jul 2 21:30:45 CDT 2003


Casey Crookston <mailto:casey at thecrookstons.com> wrote:

> SELECT * FROM jobs a, employees b WHERE .......
> 
> But here's the thing... I don't want to select * from employees.  I
> DO want everything from jobs, but from employees I only need
> first_name and last_name.  No need to clutter a record set with all
> that data that will never be used!
> 
> What would the syntax be?

SELECT j.field1, j.field2, j.field3, e.field1, e.field2 (etc.)
FROM jobs as j, employees e
WHERE ....

That should work. I see you don't have the word "as" in your query, maybe it's not necessary, but I think it will work anyway.

I'm not sure if j.* will work (never tried it). You should know that it puts more load on the server when you use * as opposed to specifying every field you want. (That's what I heard on thelist many times.)



Chris.


More information about the thelist mailing list