Solved

INNER JOIN ?

Posted on 2016-10-26
8
59 Views
Last Modified: 2016-10-27
Hi there I am not sure if this should be an INNER JOIN or not...

What I want is the outcome of the different event_IDs (which sit in tickets, however to get to tickets I need relate back to itin_items)

Set PackageEvents=oConn.Execute("SELECT * FROM itin_items,tickets WHERE itin_ID="&Package("itin_ID")&" AND itin_items.ticket_ID>0 AND itin_items.ticket_ID=tickets.ticket_ID")

Open in new window


Any help is appreciated

Thanks
0
Comment
Question by:Graeme
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 13

Expert Comment

by:Jeff Darling
ID: 41860864
I would code the join explicitly like this instead of the comma.

SELECT * FROM itin_items I
join tickets T on I.ticket_ID=T.ticket_ID
WHERE I.itin_ID=itin_ID 
  AND I.ticket_ID>0 

Open in new window

0
 

Author Comment

by:Graeme
ID: 41861601
Microsoft JET Database Engine error '80040e14'

Syntax error in FROM clause.

/home.asp, line 1722
Set PackageEvents=oConn.Execute("SELECT * FROM itin_items I JOIN tickets T ON I.ticket_ID=T.ticket_ID WHERE I.itin_ID=itin_ID AND I.ticket_ID>0")

Open in new window

0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 41861669
don't quite understand your requirements, can you provide us some of the data and your expected output?

and what's the value of Package("itin_ID") ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Graeme
ID: 41861679
Hi Ryan, what I want to do is show the event_IDs (not multiple of the same event_ID - which there maybe)

The expected output (event_ID) is numeric (within the table tickets)

Package("itin_ID") is numeric
0
 
LVL 52

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 41861684
do you mean to get the distinct Event ID from table: tickets ?

if yes, then can try:
Set PackageEvents=oConn.Execute("SELECT tickets.event_ID FROM tickets inner join itin_items on tickets.ticket_ID = itin_items.ticket_ID WHERE itin_ID="&Package("itin_ID")&" AND itin_items.ticket_ID>0 Group By tickets.event_ID")

Open in new window

if this is not what you want then pls visualize your requirements.
0
 

Author Comment

by:Graeme
ID: 41861701
Cheers for that, giving an outcome now, however it is showing the same event_ID many times

eg.
90
90
90
90

instead of just once
0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 41861709
did you add the " Group By tickets.event_ID" in your select SQL statement as mentioned in ID: 41861684?
0
 

Author Comment

by:Graeme
ID: 41861730
Sorry Sorry! it works, I have the event_ID showing a few times! Cheers!!!
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question