Solved

INNER JOIN ?

Posted on 2016-10-26
8
49 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
  • 4
  • 3
8 Comments
 
LVL 12

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 50

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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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 50

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 50

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
replace quotes with UTF-8 character 38 104
Hide row when retrieving data from database 6 67
asp syntax 3 56
JQuery to parse xml string and get element by id 4 47
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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

789 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