Skip to content

Tag: mysql

get one record at a time from joint table

I want to get a record from a joint table at a time. But I don’t hope the tables are joined as a whole. The actual tables are as follow. By specifying a cluster_id, I want to get one content name at a time where contents.status=2 and (contents name, cluster_id) pair is in content_cluster. The query in s…

How to SUM two SUMmed SQL result fields

I have a simple table structure holding records of reagent_bottles and reagent_aliquots. Aliquots are created from bottles, and an aliquot record got a foreign key, bottle_id, to a bottles id. To get the total volume of a particular reagent (counting both the volume in the bottles and the volume in the aliquo…

Need to exclude the data which have multiple records

I am trying to build a query to get the the unique data from data base, but here the problem I’m facing there is some records which have multiple records and those records have null and not null values.. I have to pick the value of the record which have the latest created date and it’s data is nul…

Datetime changing on JSON response

I am selecting start and end date of a project from project_stage named table. Here is the table elements Here datatype is DATETIME Here is the code Result on JSON response Here date time is changing its not the actual datetime which is in the table,why the date is changing on result.Here is the expected outp…