Skip to content
Advertisement

Storing count of records in SQL table

Lets say i have a table with posts, and each post has index of topic it belongs to. And i have a table with topics, with integer field, representing number of posts in this topic. When i create new …

SQL average money spent per day

I would like to get some help in writing SQL query for the table below. The table represents how much students spent at a food court on a given date. With this table, write an SQL query that …

How to display Max Date amount in another column?

I want to derive column MSP_ADULT and MSP_CHILD based on the LATEST date record ADULT_AMT to be in MSP_ADULT and CHILD_AMT to be in MSP_CHILD column. I want to my out like below. Here is the code I am running, but it is not working. Answer So you want the last values of those conditional MAX’s. Try FIRST_VALUE with a

Oracle – wrong result using sysdate

I have the following query. This query does not return any result: select snap_id from perfstat.stats$snapshot where snap_time = sysdate; no rows selected but if I format the snap_time and sysdate …

Advertisement