Solved

INNER JOIN ?

Posted on 2016-10-26
8
46 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Classic ASP + JS 4 97
Group by correlation 4 58
ASP Classic - Load test 2 49
SQL to update characters in table column 6 128
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
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/…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

777 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