Skip to content

How to write query for this?

Hi friends I have a table like this ID bid sub_bid cid sub_cid 1 0 2 1 0 2 5 0 3 0 3 3 0 0 4 4 2 0 4 0 on that table either (bid or sub_bid) OR (cid or sub_cid) will be null. I have to write a query for fetching like this.. if bid is

Doing a WHERE .. IN subquery in Doctrine 2

I’d like to select order items from all orders with a specific item. In SQL I’d do it like this: How would I do this query with the query builder? Answer This is how I would try it: I didn’t test this of course, and made some assumptions about your models. Possible problems: Limit: this has …

How to add minutes to datetime?

I want to add minutes that already exist in same table. I have a datetime and a duration. I want to get the start date/time as well as the end date/time. I can use datetime but have to specify ‘localtime’ which doesn’t work. I want the equivalent of DATEADD in SQL Server. Answer Try start_da…

How to write condition wise result providing query?

I want to write a MySQL query that gives a condition wise result. For example. I have a table with question, answer value, user chose value fields. User can attend to answer that question many times. qid rightanz wronganz 11 4 2 11 4 4 11 4 1 25 1 1 I want out put like this qid rightanz wronganz