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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Help?

Status
Not open for further replies.

dace

Programmer
Jul 21, 2001
263
US
Hi- I'm having a problem with a simple query:

-my problem is that I want everything from table1, plus anything from field2.wanted_field in a record that has a match in the comm_field fields. However, there's multiple entries for comm_field that match in both tables, but I only want one. Is this possible? I'd use SELECT DISTINCT, except that I can't because I'm returning table1.* so I'm unable to.

This is what I have:

SELECT table1.*, table2.wanted_field
FROM table1 LEFT OUTER JOIN table2
ON table1.comm_field = table2.comm_field

any help would be greatly appreciated!


 
Remember table1.* is ONLY a shorthand for

table1.field1, table1.field2, table1.field3 . . . .etc

So how much do you want the result you're after compared to the effort of typing the field list ?




G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Unfortunately I need the data from every field, there's 40+ of them, and they change weekly, so I can't just write everything out.
 
HANG ON

You have FIELDS changing ?


Sounds like you need a SERIOUS rethink of your schema.

There should be no reason for the field names to change once the schema design is complete.





G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top