473,396 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

first time code help - PostgreSQL help

hi,

I have written code in T-Sql used code converter for PostgreSQL, got below code but it is giving complier error. I have no clue in PostgreSQL so any pointer will be of great help.
------------------------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. select t.team_id, t.team_name,COALESCE(SUM(num_points),0) num_points from 
  2.    (select team_id, host_team, 3 into team_name, num_points   -----syntax error at or near ","
  3.                                                                                      -----LINE 3:    (select team_id, host_team, 3 into team_name, num_points
  4.  
  5.    from matches m
  6.    inner join teams t on m.host_team = t.team_id
  7.    where host_goals > guest_goals
  8.    Union All
  9.     select team_id, guest_team,  3 into team_name, num_points
  10.    from matches m
  11.    inner join teams t on m.guest_team = t.team_id
  12.    where guest_goals > host_goals
  13.    Union All 
  14.     select team_id, guest_team,  1 into team_name, num_points
  15.    from matches m
  16.    inner join teams t on m.guest_team = t.team_id
  17.    where guest_goals = host_goals
  18.     Union All 
  19.     select team_id, host_team,  1 into team_name, num_points
  20.    from matches m
  21.    inner join teams t on m.host_team = t.team_id
  22.    where guest_goals = host_goals)
  23.    r
  24.    right outer join teams t on r.team_id = t.team_id
  25.    group by  t.team_id, t.team_name
  26.    order by 1
Aug 30 '21 #1
1 4873
Banfa
9,065 Expert Mod 8TB
That is a long and complicated statement, I would break it down and test smaller parts of it.

Alternatively rather than translation from T-SQL I would determine what I wanted to do and re-write it directly in postgresql
Aug 31 '21 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steve Bishop | last post by:
I have an application that uses data access that runs slow the first time. My first page reads data from an ODBC source and the second page hits a MSDE database. After each page opens the first...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
11
by: Jason | last post by:
Hi I have a "problem" i have got a ASP.NET application. in this application i have included logging. in the logging i have logged how many seconds it takes for this application to fully load....
16
by: TB | last post by:
Hi all: If you think that the following comments are absolute amateurish, then please bear with me, or simply skip this thread. A couple of months back I made the decision to initiate a...
3
by: goldie11 | last post by:
Hi, This is the first time I use a gridview. I have two big problems: 1) I need to assign the columns of the gridview from the code (the cs file )- because the assignment of the columns...
1
by: chandru116 | last post by:
there is NO current page option in common dialog box...will this be solved in this DLL...can anyone send me code tht uses vbprndlg.dll with this facility.. thnks in advance..
4
kcdoell
by: kcdoell | last post by:
Hello: I am trying to create a DAO record set for the first time. I wanted to keep it simple, so I first wrote something to work for my Division field then I would expand on the code later. ...
1
by: dougancil | last post by:
I'm creating a datatable for the first time and I'm having some difficulties. I have the following code: Protected Function Dataparse(ByVal Save As String) As String Dim DataSet ds =...
0
by: WesleyN | last post by:
I've a webapplication with UserControls. When I click on a menu-item or a select-button in a grid, than I see that didn't react the first time. When I clicked for the second time then an event behind...
1
by: vivek484957 | last post by:
Hi Sir, I need your help, here is my query, it is slow first time SELECT COUNT(1) AS Results FROM ImportShipmentNew2013 WHERE CONTAINS(ProductDescription, 'neem') --AND (@HSCode='' OR...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.