Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

DB Plumber complex query


Go to End


5 Posts   1465 Views

Avatar
swaiba

Forum Moderator, 1899 Posts

16 September 2010 at 2:56am

Hi,

I have a complex query that I place into the SQL section and I get the result "no error", but no results... can DB Plumber take SQL like the following:

SELECT bi.ID,bi.Quantity,bi.Cost, BookingItemGroupID,abi.ActivityID,a.Name,abi.ScheduleID,s.StartDate,s.StartTime
FROM BookingItem bi, CourseBookingItem abi ,Activity a,Schedule s
WHERE bi.ClassName = 'CourseBookingItem' AND bi.ID = abi.ID AND a.ID = abi.ActivityID AND s.ID = abi.ScheduleID
AND bi.BookingItemGroupID IN (
   SELECT big.ID FROM BookingItemGroup big 
   WHERE big.BookingID = (
      SELECT ID FROM Booking WHERE OrderRefNumber = 'EGS200006'
   )
) 
ORDER BY bi.BookingItemGroupID ASC;

And if not, what would the limits be?

Avatar
apiening

Community Member, 60 Posts

16 September 2010 at 12:31pm

hi swaiba,

actually you can feed it any query you like cause it just passes it to the underlying db using your silverstripe db connection.

"no error" is a db plumber msg saying that your query is ok, it just didn't return any results apparently.

if you send me a test dump of your data as a pm or post simplified test data here i can have a look. (schema + data)

Avatar
swaiba

Forum Moderator, 1899 Posts

16 September 2010 at 9:05pm

Edited: 16/09/2010 9:05pm

Oops - this was indeed no data - I'm sorry - may I suggest changing the message to 'no data' or similar to indicate this for people like me :)

Avatar
apiening

Community Member, 60 Posts

20 September 2010 at 11:43am

Edited: 20/09/2010 11:44am

you'r right, done. (r110932)

Avatar
swaiba

Forum Moderator, 1899 Posts

21 September 2010 at 8:23pm

Many thanks apiening