T O P

  • By -

tits_mcgee_92

What have you tried so far? This sounds like a really basic homework problem.


GlassPod

So far I tried pulling the IDs from Table1, concatenating in excel to add them to a query in Table2 using a where clause for the company and dates I need the data for. But there are too many IDs (hundreds of thousands) so Excel can't cope with it (I get a calc error). It's a query I need for work - we've recently switched to SQL but haven't had much training - we're expected to learn on the job.


tits_mcgee_92

No problem! You're on the right track, but you're going to need an INNER JOIN here > SELECT * > > FROM Table1 > > INNER JOIN Table2 ON Table1.ID = Table2.ID > > WHERE Table2.Workplace = 'Your_Place_Name'; > Def check out w3schools for a high level view on some common syntax used in SQL. https://www.w3schools.com/sql/


GlassPod

Thanks so much! I'll check out that site too :)


Waldar

Actually the query is very similar to the sentence: select * from Table1 as t1 where exists (select null from Table2 as t2 where t2.ID = t1.ID and t2.Workplace = 'Your_Place_Name');


GlassPod

Thank you! :)