sql-server,sorting,datetime,sql-scripts,isqlquery
Something like this would return 1 sample per hour: select * from ActivityLog where id in (select max(id) maxID from ActivityLog where activityDateTime between @startDateTime and @endDateTime group by DATEPART(hour, activityDateTime)) I would use this concept to build a stored proc that moved the data around and then I would...
mysql,sql,database,qsqlquery,isqlquery
Move the propertyname filter to the ON clause from the WHERE clause. Then join again for each property: SELECT si.ItemNumber, si.ItemTitle, si.ItemDescription, si.RetailPrice, si.Weight, sl.Quantity, c.CategoryName, style.ProperyValue as style, size.ProperyValue as size FROM StockItem si LEFT OUTER JOIN StockLevel sl ON si.pkStockItemID = sl.fkStockItemId LEFT OUTER JOIN ProductCategories c ON...
UNION ALL, in a derived table. ORDER BY on the result: select * from ( SELECT w2.Avis as Avis,w2.Cde_Sap,w2.Don_Ordre,w2.PN_in ,w2.SN_in,w2.DATE2,w2.Statut_Cde,client.Zone FROM w2 INNER JOIN client ON w2.Don_Ordre = client.Client WHERE client.Zone='CLR' UNION ALL SELECT w3.Avis,w3.Cde_Sap,w3.Don_Ordre,w3.PN_in , w3.SN_in,w3.DATE2,w3.Statut_Cde,client.Zone FROM w3 INNER JOIN client ON w3.Don_Ordre = client.Client WHERE client.Zone='CLR' ) dt...
php,mysql,database,insert-into,isqlquery
The number of columns don't match. You don't need to specify the ID if it is autoincrement. Also '$something' will literally insert $something. You want to use " to insert dynamic data. $sql = "INSERT INTO Visitors (first_name, last_name, Email_address, Phone_no, St_Addr, city, State, zip, age, Ethnicity, Signup_Date) VALUES ('".$firstname."',...