I’m working on a project in Python that interacts with a PostgreSQL data warehouse, and I’m using the psycopg2 API. I am looking to create dynamically-typed tables. For example: I would like to be able to execute the following code: and end up with a table named “animals” that contains…
Tag: sql
Getting the personal contact details of an employee
I want to get the Email, Phone and Mobile number of each employee. The ContactDetailsType contains the Label which is email,phone,fax… and ContactDetails contains the ContactDetailsTypeId (the ID of ContactDetailsType) and the Info having the value of the phone number (for example). I tried the followin…
SQL Sums with Where Clauses
I have a Table of “hours” that I am trying to create a SQL query to total some sums depending on a couple variables. In my table there are HOURS, Location, User, Activity. (with many other fields) I want to Total the sums of Sum(Hours) AS TotalHours, Sum(Hours where Location=Place1) AS OffisteHour…
SQL query missing select statement fetching data error
I am using SQL query fetching some issue data is not fetching black show. I am sharing this query here. Please help me. SQL query here select * from products where hitproduct=’0′ ORDER BY id DESC …
How to use MIN() by date in a clause that uses SUM() for another date?
I need to find all the clients that have their first order in 2017 and sum up their incomes in 2018. I have issue trying to do that in SQL clause. In my table I have 3 clients, 2 of them first …
Fetch data from one table columns whose names are value of another table
I need to fetch columns from a master table and the list of columns that i need to get will be in a metadata table for different users.This would need to be dynamic as each user might not have the …
Get today and yesterday data from mysql
SELECT * FROM att_record2 WHERE DATE(row_datentime)=DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND out_datentime=”0000-00-00 00:00:00″ AND in_datentime!=”0000-00-00 00:00:00″ I want to get data from …
Problem with deleting items from pivot table
I am building project for learning purposes in oop php where I create properties/ads, and I have three tables, properties, photos and property_photo. My goal is when I click on delete button to delete …
Data type mismatch in criteria expression. whats wrong?
how do I put an int variable in sql? int x = Convert.ToInt32(Session[“id”]); string MySQL = @”UPDATE users SET email = ‘”+Request.Form[“email”]+”‘, pname = ‘”+Request.Form[“pname”]+”‘, …
Extracting values from XML column in Oracle
I have some data in an Oracle table which is stored in an XML-format string (column response in table WS_LOG). I would like to extract data from each different node below