473,473 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

help with sql select

As you can probably tell from my query I am not a guru, just trying to
"gitter done". This query is for Dynamics GP. It is a select with left
outer and a union. Can someone help debug my syntax? Please? I'll
create a view out of it and use it in a crystal report.

SELECT openheader.custnmbr, openheader.custname,
Openheader.sopNUMBe,
openheader.DOCDATE, openheader.soptype, opendetail.itemnmbr,
opendetail.xtndprce,
openheader.frtamnt, opendetail.extdcost
FROM sop10100 as openheader
left outer join sop10200 as opendetail on sop10200.sopnumbe =
sop10100.sopnumbe and sop10200.soptype = sop10100.soptype
UNION
SELECT histheader.sopnumbe, histheader.soptype,
histdetail.itemnmbr,
histdetail.extdcost,histheader.frtamnt,histdetail. xtndprce
FROM sop30200 as histheader left outer join sop30300 as
histdetail on sop30300.sopnumbe = sop30200.sopnumbe
and sop30300.soptype = sop30200.soptype
where openheader.custnmbr = 'AARONFIT0001' or histheader.custnmbr =
'AARONFIT0001'

Joanne M
Jacksonville, FL

Aug 1 '07 #1
1 1504
UNION allows combining the results of two or more SELECT commands that
return equivalent result sets.

When using UNION the SELECT list of all the SELECTs must match up.
That is, they must have the exact same number of columns, and for each
column all must have compatible data types. Your first SELECT list
has 9 items, while the second has only 6. And they don't seem to
"line up", as the fourth item of one is a date, while the fourth item
of the other is a cost.

Roy Harvey
Beacon Falls, CT

On Wed, 01 Aug 2007 13:38:10 -0700, "Joanne M."
<jo**************@gmail.comwrote:
>As you can probably tell from my query I am not a guru, just trying to
"gitter done". This query is for Dynamics GP. It is a select with left
outer and a union. Can someone help debug my syntax? Please? I'll
create a view out of it and use it in a crystal report.

SELECT openheader.custnmbr, openheader.custname,
Openheader.sopNUMBe,
openheader.DOCDATE, openheader.soptype, opendetail.itemnmbr,
opendetail.xtndprce,
openheader.frtamnt, opendetail.extdcost
FROM sop10100 as openheader
left outer join sop10200 as opendetail on sop10200.sopnumbe =
sop10100.sopnumbe and sop10200.soptype = sop10100.soptype
UNION
SELECT histheader.sopnumbe, histheader.soptype,
histdetail.itemnmbr,
histdetail.extdcost,histheader.frtamnt,histdetail .xtndprce
FROM sop30200 as histheader left outer join sop30300 as
histdetail on sop30300.sopnumbe = sop30200.sopnumbe
and sop30300.soptype = sop30200.soptype
where openheader.custnmbr = 'AARONFIT0001' or histheader.custnmbr =
'AARONFIT0001'

Joanne M
Jacksonville, FL
Aug 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
0
by: Pat Patterson | last post by:
I'm having serious issues with a page I'm developing. I just need some simple help, and was hoping someone might be able to help me out in here. I have a form, that consists of 3 pages of...
0
by: JonathanParker | last post by:
Hello, Wondered if you could help me with a little issue I'm having. I'm exporting some data from Access to Excel and converting into some fancy graphs. The number of series' ranges from 2 to 5....
23
by: casper christensen | last post by:
Hi I run a directory, where programs are listed based on the number of clicks they have recieved. The program with most clicks are placed on top and so on. Now I would like people to be apple to...
4
by: Debbiedo | last post by:
My software program outputs an XML Driving Directions file that I need to input into an Access table (although if need be I can import a dbf or xls) so that I can relate one of the fields...
1
by: upstart | last post by:
Hi everyone…this is a tough one. You guys have been such a help before, hopefully you can point me in the right direction now. I have a Report I am working on that uses a stored procedure to...
2
by: thuythu | last post by:
Please help me.... I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
1
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.