-1

I've been scratching my head for the past days or so and can't get this idea to work.

So basically, I have a query my boss gave me that involves 4 statements.

3 of them create temp tables.

The 4th one is a join query for the 3 tables.

How do I go about this?

I saw some examples like this: PDO support for multiple queries (PDO_MYSQL, PDO_MYSQLND)

But I can't get it to work since I'm expecting a result set.

Just in case, I'm using Idiorm as my ORM, any possible solution outside that is also welcome.

Community
  • 1
  • 1
Celestz
  • 301
  • 3
  • 7
  • You could show us the diagram and the structure so we can assist you. But you can use join to get those 4 table information depending if you're using inner,left or outer. – FreedomPride Mar 23 '17 at 07:36
  • I'm not privy to the structure, 4 queries were given to me already prepared, I just have to translate them to PHP calls, problem is the first 3 of those queries are temp tables. Here's how it looks like: http://pastebin.com/weNN0BTJ – Celestz Mar 23 '17 at 07:39
  • are you in any chance inserting into the temp table? i saw your 4 queries none of them inserting – FreedomPride Mar 23 '17 at 07:51

1 Answers1

0

Found out the issue, turns out if you need to use multiline statements using temp tables you can do it but you need to add this line on top of your query block:

SET NOCOUNT ON // THIS ONE;
SELECT * FROM <tbl_name> as #temp
...
Celestz
  • 301
  • 3
  • 7