A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query



 
 
Thread Tools Display Modes
  #1  
Old June 2nd, 2009, 05:25 PM posted to microsoft.public.access.forms
finster26
external usenet poster
 
Posts: 9
Default Query

I have one table with:
YR CODE COST
2010 OL $5.50
2010 CG $1.28
2010 SW $2.25

A second table:
ST YR CODE CG SW
MAIN 2010 OL Y Y

I can achieve by a query "MAIN, 2010, OL, $5.50".

But what I need to do is when CODE="OL" then when CG="Y" or when SW="Y" to
up with:

"MAIN, 2010, OL, $5.50, $1.28, $2.25"

Thanks for your help.

  #2  
Old June 2nd, 2009, 10:40 PM posted to microsoft.public.access.forms
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Query

This works on the data you posted but it does not make sense to me.
SELECT Second_Table.ST, Second_Table.YR, Second_Table.CODE,
Format([One_Table].[Cost],"$0.00") & ", " &
Format([One_Table_1].[Cost],"$0.00") & ", " &
Format([One_Table_2].[Cost],"$0.00") AS Cost_
FROM ((Second_Table LEFT JOIN One_Table ON Second_Table.YR = One_Table.YR)
LEFT JOIN One_Table AS One_Table_1 ON Second_Table.YR = One_Table_1.YR) LEFT
JOIN One_Table AS One_Table_2 ON Second_Table.YR = One_Table_2.YR
WHERE (((Second_Table.CODE)="OL") AND ((One_Table.CODE)="OL") AND
((One_Table_1.CODE)="CG") AND ((One_Table_2.CODE)="SW"));


"finster26" wrote:

I have one table with:
YR CODE COST
2010 OL $5.50
2010 CG $1.28
2010 SW $2.25

A second table:
ST YR CODE CG SW
MAIN 2010 OL Y Y

I can achieve by a query "MAIN, 2010, OL, $5.50".

But what I need to do is when CODE="OL" then when CG="Y" or when SW="Y" to
up with:

"MAIN, 2010, OL, $5.50, $1.28, $2.25"

Thanks for your help.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.